package com.tofly.watermeter.controller;

import com.tofly.common.core.entity.ResultRespone;
import com.tofly.watermeter.custom.entity.dto.InstallationDto;
import com.tofly.watermeter.service.InstallationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Bubble
 */
@Api(tags = "营销报装相关接口")
@RestController
@AllArgsConstructor
@RequestMapping("/installation")
public class InstallationController {

    private final InstallationService installationService;

    @GetMapping("/getAreaAndZone")
    @ApiOperation("获取营业区域与供水片区")
    public ResultRespone getAreaAndZone() {
        return ResultRespone.success(installationService.getAreaAndZone());
    }

    @GetMapping("/getRegion")
    @ApiOperation("获取行政区划")
    public ResultRespone getRegion(){
        return ResultRespone.success(installationService.getRegion());
    }

    @ApiOperation("获取报装编号")
    @GetMapping("/getInstallationCode")
    public ResultRespone getInstallationCode(String areaCode){
        return ResultRespone.success(installationService.getInstallationCode(areaCode));
    }

    @ApiOperation("报装文件上传接口")
    @PostMapping("/upLoadInstallation")
    public ResultRespone upLoadInstallation(MultipartFile files){
        return ResultRespone.success(installationService.upLoadInstallation(files));
    }

/*    @PostMapping("/insertInstallation")
    @ApiOperation("报装登记接口")
    public ResultRespone insertInstallation(InstallationDto dto){
        return ResultRespone.success(installationService.insertInstallation(dto));
    }*/

    @PostMapping("/syncInstallation")
    @ApiOperation("定时同步报装接口")
    public ResultRespone syncInstallation(){
        return ResultRespone.success(installationService.syncInstallation());
    }

}
