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.param.SweetManualMapGeojsonParam;
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.*;

@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);
    }

    @GetMapping("mapGeojson")
    @ApiOperation("获取地图GeoJSON数据")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
    })
    public ResponseDto<Object> getMapGeojson(@RequestParam String manualId) {
        return sweetManualExtConfigService.getMapGeojson(manualId);
    }

    @PostMapping("saveMapGeojson")
    @ApiOperation("保存地图GeoJSON数据")
    public ResponseDto<Boolean> saveMapGeojson(@RequestBody SweetManualMapGeojsonParam param) {
        return sweetManualExtConfigService.saveMapGeojson(param);
    }
}
