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.SysUserSpecialIdLogClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysUserSpecialIdLogClientApi;
import com.red.circle.other.inner.model.cmd.sys.PageUserSpecialIdCmd;
import com.red.circle.other.inner.model.cmd.sys.SysUserSpecialIdLogCmd;
import com.red.circle.other.inner.model.dto.sys.SysUserSpecialIdLogDTO;
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 pengliang on 2023/5/24
 */
@Validated
@RestController
@RequestMapping(value = SysUserSpecialIdLogClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysUserSpecialIdLogClientEndpoint implements SysUserSpecialIdLogClientApi {

  private final SysUserSpecialIdLogClientService userSpecialIdLogClientService;

  @Override
  public ResultResponse<List<SysUserSpecialIdLogDTO>> listLatest(Long userId, Integer size) {
    return ResultResponse.success(userSpecialIdLogClientService.listLatest(userId, size));
  }

  @Override
  public ResultResponse<PageResult<SysUserSpecialIdLogDTO>> pageSpecialIdLog(
      PageUserSpecialIdCmd param) {
    return ResultResponse.success(userSpecialIdLogClientService.pageSpecialIdLog(param));
  }

  @Override
  public ResultResponse<Void> addSpecialIdLog(SysUserSpecialIdLogCmd param) {
    userSpecialIdLogClientService.addSpecialIdLog(param);
    return ResultResponse.success();
  }
}
