package com.liquidnet.service.sweet.controller;

import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualExtConfigDto;
import com.liquidnet.service.sweet.param.SweetManualExtConfigParam;
import com.liquidnet.service.sweet.service.ISweetManualExtConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "草莓音乐节手册扩展配置")
@RestController
@RequestMapping("/sweet-manual-ext")
public class SweetManualExtConfigController {

    @Autowired
    private ISweetManualExtConfigService sweetManualExtConfigService;

    @GetMapping("get")
    @ApiOperation("获取手册扩展配置")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
    })
    public ResponseDto<SweetManualExtConfigDto> get(@RequestParam String manualId) {
        return sweetManualExtConfigService.get(manualId);
    }

    @PostMapping("save")
    @ApiOperation("保存手册扩展配置")
    public ResponseDto<Boolean> save(@RequestBody SweetManualExtConfigParam param) {
        return sweetManualExtConfigService.save(param);
    }

    @PostMapping("uploadGeojson")
    @ApiOperation("上传地图GeoJSON文件")
    public ResponseDto<String> uploadGeojson(@RequestPart("file") MultipartFile file) {
        return sweetManualExtConfigService.uploadGeojson(file);
    }
}
