package com.liquidnet.service.sweet.controller;


import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.entity.SweetRichtext;
import com.liquidnet.service.sweet.entity.SweetRichtextMdsk;
import com.liquidnet.service.sweet.service.ISweetRichtextMdskService;
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.*;

/**
 * <p>
 * 电子宣传手册富文本表 前端控制器
 * </p>
 *
 * @author liquidnet
 * @since 2021-08-09
 */
@Api(tags = "电子手册 富文本_MDSK")
@RestController
@RequestMapping("/mdsk/sweet-richtext")
public class SweetRichtextMdskController {

    @Autowired
    ISweetRichtextMdskService sweetRichtextMdskService;

    @GetMapping("get")
    @ApiOperation("富文本详情")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "type", value = "类型 (1签售时间 2现场地图 3官方大巴 4公共交通 5自驾导航坐标 6官方支持 7观众须知 8防疫指南 9观演攻略)", required = true),
    })
    public ResponseDto<SweetRichtextMdsk> get(@RequestParam() String manualId,
                                              @RequestParam() Integer type) {
        return sweetRichtextMdskService.get(manualId, type);
    }

    @PostMapping("add")
    @ApiOperation("添加富文本")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "manualId", value = "页数", required = true),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "details", value = "数量", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "local", value = "经纬度 经度,维度，", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "picUrl", value = "图片地址", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "type", value = "类型 (1签售时间 2现场地图 3官方大巴 4公共交通 5自驾导航坐标 6官方支持 7观众须知 8防疫指南 9观演攻略)", required = true),
    })
    public ResponseDto<Boolean> add(@RequestParam() String manualId,
                                    @RequestParam(required = false) String details,
                                    @RequestParam(required = false) String local,
                                    @RequestParam(required = false) String picUrl,
                                    @RequestParam() Integer type) {
        return sweetRichtextMdskService.add(manualId, details, local, picUrl, type);
    }

    @PostMapping("change")
    @ApiOperation("修改富文本")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "manualId", value = "页数", required = true),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "details", value = "数量", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "local", value = "经纬度 经度,维度，", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "picUrl", value = "图片地址", required = false),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "type", value = "类型 (1签售时间 2现场地图 3官方大巴 4公共交通 5自驾导航坐标 6官方支持 7观众须知 8防疫指南 9观演攻略)", required = true),
    })
    public ResponseDto<Boolean> change(@RequestParam() String manualId,
                                       @RequestParam(required = false) String details,
                                       @RequestParam(required = false) String local,
                                       @RequestParam(required = false) String picUrl,
                                       @RequestParam() Integer type) {
        return sweetRichtextMdskService.change(manualId, details, local, picUrl, type);
    }

}
