package com.tashow.cloud.trade.controller.app.aftersale;

// 移除Swagger相关导入

import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.common.util.object.BeanUtils;
import com.tashow.cloud.trade.controller.app.aftersale.vo.log.AppAfterSaleLogRespVO;
import com.tashow.cloud.trade.dal.dataobject.aftersale.AfterSaleLogDO;
import com.tashow.cloud.trade.service.aftersale.AfterSaleLogService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.tashow.cloud.common.pojo.CommonResult.success;


// 用户 App - 售后日志
@RestController
@RequestMapping("/trade/after-sale-log")
@Validated
@Slf4j
public class AppAfterSaleLogController {

    @Resource
    private AfterSaleLogService afterSaleLogService;

    @GetMapping("/list")
    // 获得售后日志列表
    // afterSaleId: 售后编号 - 必填，示例：1
    public CommonResult<List<AppAfterSaleLogRespVO>> getAfterSaleLogList(
            @RequestParam("afterSaleId") Long afterSaleId) {
        List<AfterSaleLogDO> logs = afterSaleLogService.getAfterSaleLogList(afterSaleId);
        return success(BeanUtils.toBean(logs, AppAfterSaleLogRespVO.class));
    }

}
