package com.seer.teach.mall.order.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mall.order.service.AdminAfterSaleLogService;
import com.seer.teach.mall.request.AfterSaleLogPageReq;
import com.seer.teach.mall.response.AfterSaleLogResp;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商家端 - 售后日志管理接口
 */
@Tag(name = "商家端 - 售后日志管理")
@RequiredArgsConstructor
@LogPrint
@RestController
@RequestMapping("/mall/merchant/after-sale/logs")
public class MerchantAfterSaleLogController {

    private final AdminAfterSaleLogService adminAfterSaleLogService;

    @PostMapping("/page")
    @Operation(summary = "分页查询售后日志")
    @SaCheckPermission("admin:merchant:after-sale:log:page")
    public ResultBean<PageListBean<AfterSaleLogResp>> getPageList(@RequestBody AfterSaleLogPageReq reqVO) {
        reqVO.setMerchantId(StpUtil.getLoginIdAsInt());
        PageListBean<AfterSaleLogResp> pageResult = adminAfterSaleLogService.getPageList(reqVO);
        return ResultBean.success(pageResult);
    }
}