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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.sys.SysMessageCopywritingTypeClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysMessageCopywritingTypeClientApi;
import com.red.circle.other.inner.model.cmd.sys.SysMessageCopywritingTypeQryCmd;
import com.red.circle.other.inner.model.dto.sys.SysMessageCopywritingTextTypeDTO;
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 zongpubin on 2023/11/10
 */
@Validated
@RestController
@RequestMapping(value = SysMessageCopywritingTypeClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysMessageCopywritingTypeClientEndpoint implements SysMessageCopywritingTypeClientApi {

  private final SysMessageCopywritingTypeClientService messageCopywritingTypeClientService;

  @Override
  public ResultResponse<PageResult<SysMessageCopywritingTextTypeDTO>> pageCopywritingTextType(
      SysMessageCopywritingTypeQryCmd query) {
    return ResultResponse.success(
        messageCopywritingTypeClientService.pageCopywritingTextType(query));
  }

  @Override
  public ResultResponse<Void> addTypeAndContent(SysMessageCopywritingTextTypeDTO param) {
    messageCopywritingTypeClientService.addTypeAndContent(param);
    return ResultResponse.success();
  }

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