package com.cool.store.controller.webb;

import com.cool.store.common.PageBasicInfo;
import com.cool.store.dto.ShopSignerInfoDTO;
import com.cool.store.dto.decoration.DecorationListDTO;
import com.cool.store.dto.decoration.DecorationTeamDTO;
import com.cool.store.request.decoration.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.DecorationHandleService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author suzhuhong
 * @Date 2025/10/30 18:00
 * @Version 1.0
 */
@RequestMapping("/pc/decoration")
@RestController
@Api(tags = "装修分配团队")
@Slf4j
public class DecorationAllocationController {

    @Resource
    private DecorationHandleService decorationHandleService;


    @PostMapping("/addTeam")
    @ApiOperation("添加团队")
    public ResponseResult<Boolean> addTeam(@RequestBody AddTeamRequest request){
        return ResponseResult.success(decorationHandleService.addTeam(request));
    }

    @PostMapping("/update")
    @ApiOperation("修改团队")
    public ResponseResult<Boolean> update(@RequestBody UpdateTeamRequest request){
        return ResponseResult.success(decorationHandleService.update(request));
    }

    @PostMapping("/deleteByTeamId")
    @ApiOperation("删除团队")
    public ResponseResult<Boolean> deleteByTeamId(@RequestBody DeletedRequest request){
        return ResponseResult.success(decorationHandleService.deleteByTeamId(request.getTeamId()));
    }

    @PostMapping("/listByCondition")
    @ApiOperation("查询团队")
    public ResponseResult<PageInfo<DecorationTeamDTO>> listByCondition(@RequestBody PageBasicInfo pageBasicInfo){
        return ResponseResult.success(decorationHandleService.listByCondition(pageBasicInfo));
    }

    @PostMapping("/getDecorationAssignList")
    @ApiOperation("装修分配列表/待办列表 查询待办时 分配状态传-0")
    public ResponseResult<PageInfo<DecorationListDTO>> getDecorationAssignList(@RequestBody DecorationListRequest pageBasicInfo){
        return ResponseResult.success(decorationHandleService.getDecorationAssignList(pageBasicInfo));
    }

    @GetMapping("/getShopSignerInfo")
    @ApiOperation("详情中获取签约人信息")
    public ResponseResult<ShopSignerInfoDTO> getShopSignerInfo(@RequestParam("shopId") Long shopId){
        return ResponseResult.success(decorationHandleService.getShopSignerInfo(shopId));
    }

    @PostMapping("/confirm")
    @ApiOperation("确认")
    public ResponseResult<Boolean> updateConstructionTeam(@RequestBody UpdateConstructionTeamRequest request){
        return ResponseResult.success(decorationHandleService.updateConstructionTeam(request));
    }


}
