package com.bonus.material.book.controller;

import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.material.book.domain.BookCarDetailDto;
import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.book.service.BookCarService;
import com.bonus.material.contract.domain.BmContract;
import com.bonus.material.contract.service.BmContractService;
import com.bonus.material.device.domain.vo.DevInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：liang.chao
 * @Date：2024/11/22 - 16:36
 */
@Api(value = "预约车", tags = {"预约车"})
@RestController
@RequestMapping("/bookCar")
public class BookCarController extends BaseController {

    @Resource
    private BookCarService bookCarService;

    @Resource
    private BmContractService bmContractService;

    /**
     * 添加预约车
     */
    @ApiOperation(value = "添加预约车")
    @PostMapping("/addBookCar")
    public AjaxResult addBookCar(@RequestBody BookCarInfoDto bookCarInfoDto) {
        return bookCarService.addBookCar(bookCarInfoDto);
    }

    /**
     * 查询预约车订单详情
     */
    @ApiOperation(value = "查询预约车订单详情")
    @GetMapping("/getBookCarDetails")
    public AjaxResult getBookCarDetails(BookCarInfoDto devInfo) {
        return bookCarService.getBookCarDetails(devInfo);
    }

    /**
     * 删除预约车
     * @param devInfo
     * @return
     */
    @ApiOperation(value = "删除预约车")
    @PostMapping("/deleteById")
    public AjaxResult deleteById(@RequestBody BookCarInfoDto devInfo) {
        return bookCarService.deleteById(devInfo);
    }

    @ApiOperation(value = "删除预约车")
    @PostMapping("/deleteByIds")
    public AjaxResult deleteByIds(@RequestBody BookCarInfoDto devInfo) {
        return bookCarService.deleteByIds(devInfo);
    }

    /**
     * 查询立即承租详情
     */
    @ApiOperation(value = "查询立即承租详情")
    @PostMapping("/getBookCarDetailByMaId")
    public AjaxResult getBookCarDetailByMaId(@RequestBody BookCarInfoDto devInfo) {
        return bookCarService.getBookCarDetailByMaId(devInfo);
    }


    @ApiOperation(value = "购物车免责声明")
    @GetMapping("/disclaimer")
    public AjaxResult disclaimer() {
        BmContract bmContract = bmContractService.disclaimer();
        return AjaxResult.success(bmContract);
    }

}
