package com.ruoyi.info.collection.controller;

import com.ruoyi.info.collection.domain.vo.EnumOptionVO;
import com.ruoyi.info.collection.enums.*;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * DPC枚举接口Controller
 *
 * @author ruoyi
 */
@Tag(name = "枚举接口", description = "中介黑名单相关枚举选项接口")
@RestController
@RequestMapping("/ccdi/enum")
public class CcdiEnumController {

    /**
     * 获取人员类型选项
     */
    @Operation(summary = "获取人员类型选项")
    @GetMapping("/indivType")
    public AjaxResult getIndivTypeOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (IndivType type : IndivType.values()) {
            options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取性别选项
     */
    @Operation(summary = "获取性别选项")
    @GetMapping("/gender")
    public AjaxResult getGenderOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (Gender gender : Gender.values()) {
            options.add(new EnumOptionVO(gender.getCode(), gender.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取证件类型选项
     */
    @Operation(summary = "获取证件类型选项")
    @GetMapping("/certType")
    public AjaxResult getCertTypeOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (CertType type : CertType.values()) {
            options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取关联关系选项
     */
    @Operation(summary = "获取关联关系选项")
    @GetMapping("/relationType")
    public AjaxResult getRelationTypeOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (RelationType type : RelationType.values()) {
            options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取主体类型选项
     */
    @Operation(summary = "获取主体类型选项")
    @GetMapping("/corpType")
    public AjaxResult getCorpTypeOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (CorpType type : CorpType.values()) {
            options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取企业性质选项
     */
    @Operation(summary = "获取企业性质选项")
    @GetMapping("/corpNature")
    public AjaxResult getCorpNatureOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (CorpNature nature : CorpNature.values()) {
            options.add(new EnumOptionVO(nature.getCode(), nature.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取中介类型选项
     */
    @Operation(summary = "获取中介类型选项")
    @GetMapping("/intermediaryType")
    public AjaxResult getIntermediaryTypeOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (IntermediaryType type : IntermediaryType.values()) {
            options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取中介状态选项
     */
    @Operation(summary = "获取中介状态选项")
    @GetMapping("/intermediaryStatus")
    public AjaxResult getIntermediaryStatusOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (IntermediaryStatus status : IntermediaryStatus.values()) {
            options.add(new EnumOptionVO(status.getCode(), status.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取数据来源选项
     */
    @Operation(summary = "获取数据来源选项")
    @GetMapping("/dataSource")
    public AjaxResult getDataSourceOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (DataSource source : DataSource.values()) {
            options.add(new EnumOptionVO(source.getCode(), source.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取实体风险等级选项
     */
    @Operation(summary = "获取实体风险等级选项")
    @GetMapping("/enterpriseRiskLevel")
    public AjaxResult getEnterpriseRiskLevelOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (EnterpriseRiskLevel level : EnterpriseRiskLevel.values()) {
            options.add(new EnumOptionVO(level.getCode(), level.getDesc()));
        }
        return AjaxResult.success(options);
    }

    /**
     * 获取企业来源选项
     */
    @Operation(summary = "获取企业来源选项")
    @GetMapping("/enterpriseSource")
    public AjaxResult getEnterpriseSourceOptions() {
        List<EnumOptionVO> options = new ArrayList<>();
        for (EnterpriseSource source : EnterpriseSource.values()) {
            options.add(new EnumOptionVO(source.getCode(), source.getDesc()));
        }
        return AjaxResult.success(options);
    }
}
