package com.sckw.transport.controller.enterpriseApp;


import com.sckw.core.web.response.BaseResult;
import com.sckw.core.web.response.result.PageDataResult;
import com.sckw.transport.model.param.forklift.reponse.ForkliftOrderFilterResp;
import com.sckw.transport.model.param.forklift.reponse.ForkliftOrderResp;
import com.sckw.transport.model.param.forklift.request.ForkliftOrderCancelParam;
import com.sckw.transport.model.param.forklift.request.ForkliftOrderFilterParam;
import com.sckw.transport.model.param.forklift.request.ForkliftOrderQueryParam;
import com.sckw.transport.model.param.forklift.request.ForkliftOrderTakingParam;
import com.sckw.transport.model.vo.StatisticsWaybillResp;
import com.sckw.transport.service.app.ForkliftOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
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;

import java.util.List;

/**
 * Author: donglang
 * Time: 2026-01-05
 * Des: 铲车司机Controller
 * Version: 1.0
 */

@RestController
@RequestMapping("/appForklift")
@RequiredArgsConstructor
@Tag(name = "APP铲车司机接口", description = "app端铲车司机接口")
public class AppForkliftController {

    private final ForkliftOrderService forkliftOrderService;

    /**
     * 分页查询铲车订单
     *
     * @param param
     * @return
     */
    @Operation(summary = "分页铲车运单", description = "分页查询铲车的运单")
    @PostMapping("/pageQueryForkliftOrder")
    public BaseResult<PageDataResult<ForkliftOrderResp>> pageQueryForkliftOrder(@RequestBody @Valid ForkliftOrderQueryParam param){
        PageDataResult<ForkliftOrderResp> LogisticsOrderList = forkliftOrderService.pageQueryForkliftOrder(param);
        return BaseResult.success(LogisticsOrderList);
    }

    /**
     * 筛选
     *
     * @param param
     * @return
     */
    @Operation(summary = "筛选", description = "筛选")
    @PostMapping("/filterQuery")
    public BaseResult<List<ForkliftOrderFilterResp>> filterQuery(@RequestBody @Valid ForkliftOrderFilterParam param){
        List<ForkliftOrderFilterResp> LogisticsOrderList = forkliftOrderService.filterQuery(param);
        return BaseResult.success(LogisticsOrderList);
    }


    /**
     * 铲车订单状态统计
     *
     * @param param
     * @return
     */
    @Operation(summary = "铲车订单状态统计", description = "铲车订单状态统计")
    @PostMapping("/statisticsForkliftOrder")
    public BaseResult<StatisticsWaybillResp> statisticsForkliftOrder(@RequestBody @Valid ForkliftOrderQueryParam param){
        return BaseResult.success(forkliftOrderService.statisticsForkliftOrder(param));
    }

    /**
     * 铲车接单
     *
     * @param param
     * @return
     */
    @Operation(summary = "铲车接单", description = "铲车接单")
    @PostMapping("/forkliftOrderTaking")
    public BaseResult forkliftOrderTaking(@RequestBody @Valid ForkliftOrderTakingParam param){
        forkliftOrderService.forkliftOrderTaking(param);
        return BaseResult.success();
    }

    /**
     * 铲车取消接单
     *
     * @param param
     * @return
     */
    @Operation(summary = "铲车取消接单", description = "铲车取消接单")
    @PostMapping("/cancelForkliftOrder")
    public BaseResult cancelForkliftOrder(@RequestBody @Valid ForkliftOrderCancelParam param){
        forkliftOrderService.cancelForkliftOrder(param);
        return BaseResult.success();
    }

    /**
     * 装载完成
     *
     * @param param
     * @return
     */
    @Operation(summary = "装载完成", description = "装载完成")
    @PostMapping("/loadingCompleted")
    public BaseResult loadingCompleted(@RequestBody @Valid ForkliftOrderCancelParam param){
        forkliftOrderService.loadingCompleted(param);
        return BaseResult.success();
    }

}
