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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.inner.endpoint.user.user.api.PasswordLogClientApi;
import com.red.circle.other.inner.model.cmd.user.UserPasswordLogQryCmd;
import com.red.circle.other.inner.model.dto.user.PasswordLogDTO;
import com.red.circle.other.app.inner.service.user.user.PasswordLogClientService;
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 2024/1/5
 */
@Validated
@RestController
@RequestMapping(value = PasswordLogClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class PasswordLogClientEndpoint implements PasswordLogClientApi {

  private final PasswordLogClientService passwordLogClientService;

  @Override
  public ResultResponse<Boolean> save(PasswordLogDTO dto) {
    return ResultResponse.success(passwordLogClientService.save(dto));
  }

  @Override
  public ResultResponse<PageResult<PasswordLogDTO>> pageListQuery(UserPasswordLogQryCmd query) {
    return ResultResponse.success(passwordLogClientService.pageListQuery(query));
  }

}
