package com.persagy.legend.controller

import com.persagy.legend.models.entities.LegendOutline
import com.persagy.legend.services.LegendOutlineService
import com.sybotan.service.models.requests.SCountRequest
import com.sybotan.service.models.requests.SCreateRequest
import com.sybotan.service.models.requests.SQueryRequest
import com.sybotan.service.models.requests.SUpdateRequest
import com.sybotan.service.models.responses.SBaseResponse
import com.sybotan.service.models.responses.SCountResponse
import com.sybotan.service.models.responses.SCreateResponse
import com.sybotan.service.models.responses.SQueryResponse
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 轮廓图例接口类
 *
 * @author  zy
 */
@Tag(name = "003、轮廓图例")
@RestController
@RequestMapping("/outline")
class LegendOutlineController {
    /**
     * 创建轮廓图例
     */
    @Operation(summary= "创建轮廓图例-批量")
    @PostMapping("/create")
    fun create(@RequestBody request: SCreateRequest<LegendOutline>): SCreateResponse<LegendOutline> {
        return LegendOutlineService.createList(request)
    }

    /**
     * 更新轮廓图例
     */
    @Operation(summary = "轮廓图例修改-批量")
    @PostMapping(value = ["/update"])
    fun update(@RequestBody request: SUpdateRequest<LegendOutline>): SBaseResponse {
        return LegendOutlineService.updateList(request)
    }

    /**
     * 保存图例
     */
    @Operation(summary = "轮廓图例保存")
    @PostMapping(value = ["/save"])
    fun save(@RequestBody request: LegendOutline): SBaseResponse {
        return LegendOutlineService.save(request)
    }

    /**
     * 根据id删除轮廓图例
     */
    @Operation(summary = "轮廓图例删除", description = "")
    @PostMapping(value = ["/delete"])
    fun delete(@RequestBody idList: ArrayList<LegendOutline>): SBaseResponse {
        return LegendOutlineService.deleteByKeysList(idList)
    }

    /**
     * 查询轮廓图例信息
     */
    @Operation(summary = "查询轮廓图例-批量", description = " 级联：类型信息（classInfo）")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: SQueryRequest): SQueryResponse<LegendOutline> {
        return LegendOutlineService.pageQuerys(request)
    }

    /**
     * 统计轮廓图例
     */
    @Operation(summary = "统计轮廓图例")
    @PostMapping(value = ["/count"])
    fun count(@RequestBody request: SCountRequest): SCountResponse {
        return LegendOutlineService.count(request)
    }
}