package com.cool.store.controller.webb;

import com.cool.store.dto.AccountAuditDTO;
import com.cool.store.dto.AccountEntryStatusAuditDTO;
import com.cool.store.dto.GetAccessTokenDTO;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.dto.AccountEntryStatusChangeDTO;
import com.cool.store.enums.DownSystemTypeEnum;
import com.cool.store.request.ZxjpApiRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PushService;
import com.cool.store.service.ShopAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

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

/**
 * @Author suzhuhong
 * @Date 2025/4/8 14:52
 * @Version 1.0
 */
@RestController
@RequestMapping("/pc/account")
@Api(tags = "平台账号")
@Slf4j
public class ShopAccountController {


    @Resource
    ShopAccountService accountService;
    @Resource
    PushService pushService;

    @ApiOperation("根据门店shopId查询平台账号")
    @GetMapping("/getShopAccountByShopId")
    public ResponseResult<List<ShopAccountDTO>> getShopAccountByShopId(@RequestParam(value = "shopId", required = true) Long shopId) {
        return ResponseResult.success(accountService.getShopAccountByShopId(shopId));
    }

    @ApiOperation("根据门店shopId与平台名称查询数据")
    @GetMapping("/getData")
    public ResponseResult<ZxjpApiRequest> getData(@RequestParam(value = "shopId", required = true) Long shopId,
                                                  @RequestParam(value = "systemName",required = false) DownSystemTypeEnum systemName) {
        return ResponseResult.success(accountService.getData(shopId,systemName));
    }

    @ApiOperation("开通状态审核")
    @PostMapping("/auditAccount")
    public ResponseResult<Boolean> auditAccount(@RequestBody @Validated AccountAuditDTO accountAuditDTO) {
        return ResponseResult.success(accountService.auditAccount(accountAuditDTO));
    }

    @ApiOperation("推送数据")
    @PostMapping("/pushData")
    public ResponseResult<Boolean> pushData(@RequestBody @Validated AccountAuditDTO accountAuditDTO) {
        return ResponseResult.success(accountService.pushData(accountAuditDTO));
    }

    @ApiOperation("进件状态审核")
    @PostMapping("/accountEntryStatusAudit")
    public ResponseResult<Boolean> accountEntryStatusAudit(@RequestBody @Validated AccountEntryStatusAuditDTO dto) {
        return ResponseResult.success(accountService.accountEntryStatusAudit(dto));
    }

    @ApiOperation("进件状态修改")
    @PostMapping("/accountEntryStatusChange")
    public ResponseResult<Boolean> accountEntryStatusChange(@RequestBody @Validated AccountEntryStatusChangeDTO dto) {
        return ResponseResult.success(accountService.accountEntryStatusChange(dto));
    }

    @ApiOperation("密码数据处理")
    @GetMapping("/handleOldData")
    public ResponseResult<Boolean> handleOldData() {
        return ResponseResult.success(accountService.handleOldData());
    }

    @ApiOperation("密码数据处理2.0")
    @GetMapping("/handleAccountPassword")
    public ResponseResult<Boolean> handleAccountPassword() {
        return ResponseResult.success(accountService.handleAccountPassword());
    }

    @ApiOperation("密码数据处理3.0")
    @GetMapping("/handleOldDataAccount")
    public ResponseResult<Boolean> handleOldDataAccount() {
        return ResponseResult.success(accountService.handleOldDataAccount());
    }



}
