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.SysWeekStarGroupClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysWeekStarGroupClientApi;
import com.red.circle.other.inner.model.cmd.sys.SysWeekStarGroupAddParamCmd;
import com.red.circle.other.inner.model.cmd.sys.SysWeekStarGroupQryCmd;
import com.red.circle.other.inner.model.dto.sys.SysWeekStarGroupDTO;
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/3
 */
@Validated
@RestController
@RequestMapping(value = SysWeekStarGroupClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysWeekStarGroupClientEndpoint implements SysWeekStarGroupClientApi {

  private final SysWeekStarGroupClientService weekStarGroupClientService;


  @Override
  public ResultResponse<PageResult<SysWeekStarGroupDTO>> getPage(SysWeekStarGroupQryCmd query) {
    return ResultResponse.success(weekStarGroupClientService.getPage(query));
  }

  @Override
  public ResultResponse<Void> addGroup(SysWeekStarGroupAddParamCmd param) {
    weekStarGroupClientService.addGroup(param);
    return ResultResponse.success();
  }

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