package com.red.circle.other.app.inner.endpoint.sys;


import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.sys.SysCustomerServiceClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysCustomerServiceClientApi;
import com.red.circle.other.inner.model.cmd.sys.CustomerServiceConfigCmd;
import com.red.circle.other.inner.model.dto.sys.SysCustomerServiceConfigDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客服.
 *
 * @author lisizhe on 2023/5/24
 */
@Validated
@RestController
@RequestMapping(value = SysCustomerServiceClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysCustomerServiceClientEndpoint implements SysCustomerServiceClientApi {

  private final SysCustomerServiceClientService customerServiceClientService;

  @Override
  public ResultResponse<Void> add(CustomerServiceConfigCmd param) {
    customerServiceClientService.add(param);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> update(CustomerServiceConfigCmd param) {
    customerServiceClientService.update(param);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> delete(Long id) {
    customerServiceClientService.delete(id);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<List<SysCustomerServiceConfigDTO>> list(String sysOrigin, String region) {
    return ResultResponse.success(customerServiceClientService.list(sysOrigin, region));
  }
}
