package com.liquidnet.service.sweet.controller;


import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.service.ISweetManualSortService;
import com.liquidnet.service.sweet.vo.SweetManualSortOptionVo;
import com.liquidnet.service.sweet.vo.SweetManualSortVo;
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 java.util.List;

/**
 * <p>
 * 电子宣传手册显示内容表 前端控制器
 * </p>
 *
 * @author liquidnet
 * @since 2021-07-23
 */
@Api(tags = "电子手册显示tag")
@RestController
@RequestMapping("/sweet-manual-sort")
public class SweetManualSortController {

    @Autowired
    private ISweetManualSortService sweetManualSortService;


    @PostMapping("add")
    @ApiOperation("保存电子手册显示模块")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
            @ApiImplicitParam(type = "query", dataType = "String", name = "content",
                    value = "模块标识，逗号分隔。可选: artist,signingTime,siteMap,howToReach,officialSupport,audienceNotice,preventionGuidelines,notice,strategy,customerService,foodGuide,album,lostFound,mapGeojson",
                    required = true)
    })
    public ResponseDto<Boolean> save(@RequestParam String manualId,
                                     @RequestParam String content) {
        return sweetManualSortService.add(manualId, content);
    }

    @GetMapping("get")
    @ApiOperation("获取电子手册显示模块")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true)
    })
    public ResponseDto<SweetManualSortVo> get(@RequestParam String manualId) {
        return sweetManualSortService.get(manualId);
    }

    @GetMapping("options")
    @ApiOperation("获取可选显示模块列表")
    public ResponseDto<List<SweetManualSortOptionVo>> options() {
        return sweetManualSortService.options();
    }
}
