package com.red.circle.other.adapter.app.violation;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.cmd.violation.UserViolationHandleCmd;
import com.red.circle.other.app.dto.cmd.violation.ViolationRecordPageQueryCmd;
import com.red.circle.other.app.dto.clientobject.violation.ViolationHandleResultCO;
import com.red.circle.other.app.dto.clientobject.violation.ViolationRecordCO;
import com.red.circle.other.app.service.violation.UserViolationService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 用户违规处理控制器
 */
@RestController
@RequestMapping("/user-violation")
@RequiredArgsConstructor
public class UserViolationRestController extends BaseController {

    private final UserViolationService userViolationService;

    /**
     * 处理用户违规
     */
    @PostMapping("/handle")
    public ViolationHandleResultCO handle(@Valid @RequestBody UserViolationHandleCmd cmd) {
        return userViolationService.handle(cmd);
    }

    /**
     * 分页查询违规记录
     */
    @PostMapping("/page-query")
    public PageResult<ViolationRecordCO> pageQuery(@Valid @RequestBody ViolationRecordPageQueryCmd cmd) {
        return userViolationService.pageQuery(cmd);
    }
}
