package com.yuchen.saas.park.service.controller.property;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.property.*;
import com.yuchen.saas.park.api.vo.property.*;
import com.yuchen.saas.park.service.service.property.IPropertyAppointHouseService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author 蔡文强
 * @Date 2023/10/27 10:56
 * @Description 预约看房主表 前端控制器
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/property/appointHouse")
public class PropertyAppointHouseController {

    @Resource
    private IPropertyAppointHouseService baseService;

    /**
     * 小程序用户端->提交看房意向
     * @param submitIntentionDTO 提交看房意向DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/submitIntention")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "小程序用户端->提交看房意向", notes = "小程序用户端->提交看房意向")
    public R<Boolean> submitIntention(@RequestBody @Validated PropertyAppointHouseSubmitIntentionDTO submitIntentionDTO) {
        return R.data(baseService.submitIntention(submitIntentionDTO));
    }

    /**
     * PC管理端/小程序管理端->意向确认
     * @param confirmIntentionDTO 意向确认DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/confirmIntention")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "PC管理端/小程序管理端->意向确认", notes = "PC管理端/小程序管理端->意向确认")
    public R<Boolean> confirmIntention(@RequestBody @Validated PropertyAppointHouseConfirmIntentionDTO confirmIntentionDTO) {
        return R.data(baseService.confirmIntention(confirmIntentionDTO));
    }

    /**
     * PC管理端/小程序管理端->意向详情
     * @param id 看房意向ID
     * @return 看房意向详情VO
     */
    @GetMapping("/getIntentionDetailById/{id}")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "PC管理端/小程序管理端->意向详情", notes = "传看房意向ID")
    public R<PropertyAppointHouseIntentionDetailVO> getIntentionDetailById(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable("id") Long id) {
        return R.data(baseService.getIntentionDetailById(id));
    }

    /**
     * PC管理端->看房意向列表(分页)
     * @param queryDTO PC端看房意向列表查询参数
     * @return PC管理端看房意向列表VO
     */
    @PostMapping("/getPcIntentionList")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "PC管理端->看房意向列表(分页)", notes = "PC管理端->看房意向列表(分页)")
    public R<NestPage<PropertyAppointHouseIntentionPcListVO>> getPcIntentionList(@RequestBody PropertyAppointHouseIntentionPcListQueryDTO queryDTO) {
        return R.data(baseService.getPcIntentionList(queryDTO));
    }

    /**
     * 小程序管理端->看房意向列表(分页)
     * @param queryDTO 小程序管理端看房意向列表查询参数
     * @return 小程序管理端看房意向列表VO
     */
    @PostMapping("/getAppIntentionList")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "小程序管理端->看房意向列表(分页)", notes = "小程序管理端->看房意向列表(分页)")
    public R<NestPage<PropertyAppointHouseIntentionAppListVO>> getAppIntentionList(@RequestBody PropertyAppointHouseIntentionAppListQueryDTO queryDTO) {
        return R.data(baseService.getAppIntentionList(queryDTO));
    }

    /**
     * PC管理端->新增预约
     * @param createAppointDTO 新增预约DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/createAppoint")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "PC管理端->新增预约", notes = "PC管理端->新增预约")
    public R<Boolean> createAppoint(@RequestBody @Validated PropertyAppointHouseCreateAppointDTO createAppointDTO) {
        return R.data(baseService.createAppoint(createAppointDTO));
    }


    /**
     * PC管理端/小程序管理端->预约登记
     * @param registerDTO 预约登记DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/appointRegister")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "PC管理端/小程序管理端->预约登记", notes = "PC管理端/小程序管理端->预约登记")
    public R<Boolean> appointRegister(@RequestBody @Validated PropertyAppointHouseRegisterDTO registerDTO) {
        return R.data(baseService.appointRegister(registerDTO));
    }

    /**
     * PC管理端/小程序管理端->看房登记
     * @param reviewRegisterDTO 看房登记DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/reviewRegister")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "PC管理端/小程序管理端->看房登记", notes = "PC管理端/小程序管理端->看房登记")
    public R<Boolean> reviewRegister(@RequestBody @Validated PropertyAppointHouseReviewRegisterDTO reviewRegisterDTO) {
        return R.data(baseService.reviewRegister(reviewRegisterDTO));
    }

    /**
     * PC管理端/小程序管理端->取消预约
     * @param cancelDTO 取消预约DTO
     * @return TRUE/FALSE
     */
    @PostMapping("/appointCancel")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "PC管理端/小程序管理端->取消预约", notes = "PC管理端/小程序管理端->取消预约")
    public R<Boolean> appointCancel(@RequestBody @Validated PropertyAppointHouseCancelDTO cancelDTO) {
        return R.data(baseService.appointCancel(cancelDTO));
    }

    /**
     * PC管理端->预约看房列表(分页)
     * @param queryDTO 预约看房列表查询参数
     * @return 预约看房列表VO
     */
    @PostMapping("/getPcAppointList")
    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "PC管理端->预约看房列表(分页)", notes = "PC管理端->预约看房列表(分页)")
    public R<NestPage<PropertyAppointHousePcListVO>> getPcAppointList(@RequestBody PropertyAppointHousePcListQueryDTO queryDTO) {
        return R.data(baseService.getPcAppointList(queryDTO));
    }

    /**
     * 小程序管理端->预约看房列表(分页)
     * @param queryDTO 预约看房列表查询参数
     * @return 预约看房列表VO
     */
    @PostMapping("/getAppAppointList")
    @ApiOperationSupport(order = 10)
    @ApiOperation(value = "小程序管理端->预约看房列表(分页)", notes = "小程序管理端->预约看房列表(分页)")
    public R<NestPage<PropertyAppointHouseAppListVO>> getAppAppointList(@RequestBody PropertyAppointHouseAppListQueryDTO queryDTO) {
        return R.data(baseService.getAppAppointList(queryDTO));
    }

    /**
     * 小程序用户端->我的预约看房列表(分页)
     * @param queryDTO 小程序用户端我的预约看房列表查询参数
     * @return 小程序用户端我的预约看房列表VO
     */
    @PostMapping("/getMyAppointList")
    @ApiOperationSupport(order = 11)
    @ApiOperation(value = "小程序用户端->我的预约看房列表(分页)", notes = "小程序用户端->我的预约看房列表(分页)")
    public R<NestPage<PropertyAppointHouseAppListVO>> getMyAppointList(@RequestBody PropertyAppointHouseAppListQueryDTO queryDTO) {
        return R.data(baseService.getMyAppointList(queryDTO));
    }

    /**
     * PC管理端/小程序管理端->预约详情
     * @param id 预约详情ID
     * @return 预约详情VO
     */
    @GetMapping("/getAppointDetailById/{id}")
    @ApiOperationSupport(order = 12)
    @ApiOperation(value = "PC管理端/小程序管理端->预约详情", notes = "传预约详情ID")
    public R<PropertyAppointHouseDetailVO> getAppointDetailById(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable("id") Long id) {
        return R.data(baseService.getAppointDetailById(id));
    }

    /**
     * 小程序用户端->我的预约详情
     * @param id 预约详情ID
     * @return 小程序用户端我的预约详情VO
     */
    @GetMapping("/getMyAppointDetailById/{id}")
    @ApiOperationSupport(order = 13)
    @ApiOperation(value = "小程序用户端->我的预约详情", notes = "传预约详情ID")
    public R<PropertyAppointHouseMyDetailVO> getMyAppointDetailById(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable("id") Long id) {
        return R.data(baseService.getMyAppointDetailById(id));
    }
}
