package com.zt.plat.module.base.api.businessdictionarytype;

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.api.businessdictionarytype.dto.BusinessDictionaryDataDTO;
import com.zt.plat.module.base.api.businessdictionarytype.dto.BusinessDictionaryTypePageReqDTO;
import com.zt.plat.module.base.api.businessdictionarytype.dto.BusinessDictionaryTypeRespDTO;
import com.zt.plat.module.base.api.businessdictionarytype.dto.BusinessDictionaryTypeSaveReqDTO;
import com.zt.plat.module.base.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 业务字典类型")
public interface BusinessDictionaryTypeApi {

    String PREFIX = ApiConstants.PREFIX + "/business-dictionary-type";

    @PostMapping(PREFIX + "/create")
    @Operation(summary = "创建业务字典类型")
    CommonResult<BusinessDictionaryTypeRespDTO> createBusinessDictionaryType(@Valid @RequestBody BusinessDictionaryTypeSaveReqDTO createReqDTO);

    @PutMapping(PREFIX + "/update")
    @Operation(summary = "更新业务字典类型")
    CommonResult<Boolean> updateBusinessDictionaryType(@Valid @RequestBody BusinessDictionaryTypeSaveReqDTO updateReqDTO);

    @DeleteMapping(PREFIX + "/delete")
    @Operation(summary = "删除业务字典类型")
    CommonResult<Boolean> deleteBusinessDictionaryType(@RequestParam("id") Long id);

    @DeleteMapping(PREFIX + "/delete-list")
    @Operation(summary = "批量删除业务字典类型")
    CommonResult<Boolean> deleteBusinessDictionaryTypeList(@RequestBody List<Long> ids);

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "获得业务字典类型")
    CommonResult<BusinessDictionaryTypeRespDTO> getBusinessDictionaryType(@RequestParam("id") Long id);

    @PostMapping(PREFIX + "/page")
    @Operation(summary = "获得业务字典类型分页")
    CommonResult<PageResult<BusinessDictionaryTypeRespDTO>> getBusinessDictionaryTypePage(@Valid @RequestBody BusinessDictionaryTypePageReqDTO pageReqDTO);

    @GetMapping(PREFIX + "/business-dictionary-data/list-by-dictionary-type-id")
    @Operation(summary = "获得业务字典数据列表")
    CommonResult<List<BusinessDictionaryDataDTO>> getBusinessDictionaryDataListByDictionaryTypeId(@RequestParam("dictionaryTypeId") Long dictionaryTypeId);

    @GetMapping(PREFIX + "/business-dictionary-data/list-by-type")
    @Operation(summary = "根据字典类型编码获取业务字典数据列表")
    CommonResult<List<BusinessDictionaryDataDTO>> getBusinessDictionaryDataListByType(@RequestParam("type") String type);
}
