package com.njzscloud.supervisory.customer.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.customer.pojo.param.SearchCustomerParam;
import com.njzscloud.supervisory.customer.pojo.result.SearchCustomerResult;
import com.njzscloud.supervisory.customer.service.CustomerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客户管理
 */
@RestController
@RequestMapping("/customer")
@RequiredArgsConstructor
public class CustomerController {
    private final CustomerService customerService;

    /**
     * 客户分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<SearchCustomerResult>> paging(PageParam pageParam, SearchCustomerParam searchCustomerParam) {
        return R.success(customerService.paging(pageParam, searchCustomerParam));
    }

    /**
     * 禁启用短驳权限
     */
    @GetMapping("/short_barge")
    public R<?> shortBarge(
            @RequestParam("enable") Boolean enable,
            @RequestParam("customerId") Long customerId
    ) {
        customerService.shortBarge(enable, customerId);
        return R.success();
    }

}
