package com.kxs.store.biz.controller.kxsapp;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kxs.common.core.util.R;
import com.kxs.store.api.dto.kxsapp.storeOrder.*;
import com.kxs.store.api.vo.kxsapp.userOrder.UserApplyMahineListVO;
import com.kxs.store.biz.service.KxsMachineApplyService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.*;

/**
 * 用户机具申请
 *
 * @author 系统
 * @since 2024-01-08 11:15:03
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("userOrder")
public class UserOrderController {

    /**
     * 服务对象
     */
    private final KxsMachineApplyService kxsMachineApplyService;



    /**
     * 订单管理-申请机具
     *
     * @param param 实体对象
     * @return 订单管理-申请机具
     */
    @PostMapping("/applyMachine")
    public R applyMachine(@Valid @RequestBody ApplyMachineDTO param) {

        return kxsMachineApplyService.applyMachine(param);
    }

    /**
     * 订单管理-申请机具
     *
     * @param param 实体对象
     * @return 订单管理-申请机具
     */
    @PostMapping("/applyVhostGdSn")
    public R applyVhostGdSn(@Valid @RequestBody ApplyMachineDTO param) {

        return kxsMachineApplyService.applyVhostGdSn(param);
    }

    /**
     * 机具申请-申请记录
     *
     * @param page 分页对象
     * @return 机具申请-申请记录
     */
    @GetMapping("/userApplyMachineList")
    public R userApplyMachineList(@ParameterObject Page<UserApplyMahineListVO> page) {

        return R.ok(kxsMachineApplyService.userApplyMachineList(page));
    }


    /**
     * 机具申请-申请记录详情
     *
     * @param id 主键
     * @return 机具申请-申请记录详情
     */
    @GetMapping("/userApplyMachineDetail")
    public R userApplyMachineDetail(@RequestParam("id") Long id) {

        return R.ok(kxsMachineApplyService.userApplyMachineDetail(id));
    }




}

