declare namespace API {
  type APIResponse<T> = {
    code: number;
    success: boolean;
    message: string;
    data: T;
  }

  // 用户相关接口类型定义
  export interface UserListRequest {
    basePageRequest: BasePageRequest;
    keyword?: string;
    [property: string]: any;
  }

  export interface UserItem {
    userId: string;
    userName: string;
    userDept: string;
    userDeptId: string;
    [property: string]: any;
  }

  // 评价任务人员选择器相关接口
  export interface PersonnelItem {
    id: string;
    name: string;
    userDept: string;
    userDeptId: string;
    position?: string;
    selected?: boolean;
    isSelected?: boolean;
  }

  export interface Department {
    id: string;
    name: string;
  }

  export type RegisterRequest = {
    coscoSupplierBank: CoscoSupplierBank[];
    coscoSupplierBase: CoscoSupplierBase;
    coscoSupplierInvoice: CoscoSupplierInvoice;
    coscoSupplierQualifications: CoscoSupplierQualification[];
    coscoSupplierSurvey: CoscoSupplierSurvey;
    coscoSupplierSurveyAttachments: CoscoSupplierSurveyAttachment[];
    coscoSupplierSurveyQuestionReply: CoscoSupplierSurveyQuestionReply[];
    [property: string]: any;
  }

  export type CoscoSupplierBank = {
    account?: string;
    accountName?: string;
    bank?: string;
    city?: string;
    currency?: string;
    interbankNumber?: string;
    nation?: string;
    province?: string;
    [property: string]: any;
  }

  export type CoscoSupplierBase = {
    capital: number;
    contactsEmail: string;
    contactsName: string;
    contactsPhone: string;
    contactsType: string;
    enterpriseType: string;
    idCard: string;
    legalPerson: string;
    licenceAccessory: string;
    licenceDate: string;
    name: string;
    nameEn: string;
    parentCompanyInvestor: string;
    range: string;
    regAddress: string;
    socialCreditCode: string;
    supplierType: string;
    telephone: string;
    workAddress: string;
    [property: string]: any;
  }

  export type CoscoSupplierInvoice = {
    account: string;
    address: string;
    bank: string;
    head: string;
    phone: string;
    qualificationCertificate: string;
    taxpayerCode: string;
    taxpayerType: string;
    [property: string]: any;
  }

  export type CoscoSupplierQualification = {
    accessory?: string;
    authority?: string;
    certificateType?: string;
    code?: string;
    dateTime?: string;
    name?: string;
    termOfValidity?: string;
    typeLevel?: string;
    [property: string]: any;
  }

  export type CoscoSupplierSurvey = {
    dateTime: string;
    email: string;
    name: string;
    phone: string;
    position: string;
    supplierName: string;
    [property: string]: any;
  }

  export type CoscoSupplierSurveyAttachment = {
    attachmentsType: string;
    fileName: string;
    filePath: string;
    fileSize: string;
    fileType: string;
    fileUrl: string;
    [property: string]: any;
  }

  export type CoscoSupplierSurveyQuestionReply = {
    replyValue?: string;
    surveyQuestionId?: string;
    [property: string]: any;
  }
  // 调查问卷返回类型
  type SurveyQuestionResponse = {
    id: string;
    question: string;
    orderBy: string;
    coscoSurveyQuestionOptionList: {
      id: string;
      opentionValue: string;
      optionName: string;
    }[];
  }[]

  // 通用响应类型
  type Response<T = any> = {
    success: boolean;
    data: T;
    message?: string;
    code?: number;
  };

  // 分页响应类型
  type PageResponse<T = any> = {
    records: T[];
    total: number;
    size: number;
    current: number;
    pages: number;
  };

  // 基础分页请求
  interface BasePageRequest {
    pageNo: number;
    pageSize: number;
    [property: string]: any;
  }

  // 分页请求参数
  interface PageRequest {
    basePageRequest: BasePageRequest;
    [property: string]: any;
  }

  // 文件上传响应
  export interface UploadResponse {
    id: string;
    fileName: string;
    fileSize: number;
    fileType: string;
    fileUrl: string;
  }

  //
  // 供应商评价任务状态枚举
  export enum TaskStatus {
    DRAFT = '0',       // 草稿
    PUBLISHED = '1',   // 已发布
    PROCESSING = '2',  // 进行中
    COMPLETED = '3',   // 已完成
    CANCELED = '4',    // 已取消
  }

  // 供应商评价任务类型枚举
  export enum TaskType {
    REGULAR = '1',    // 常规评价
    SPECIAL = '2',    // 专项评价
  }

  // 供应商评价任务记录类型
  export interface TaskRecord {
    id: string;
    taskName: string;
    taskCode: string;
    taskType: string;
    templateName: string;
    status: string;
    startTime: string;
    endTime: string;
    createBy: string;
    createTime: string;
    updateBy?: string;
    updateTime?: string;
    key?: string;
  }

  // 供应商评价任务查询参数
  export interface TaskSearchParams {
    taskName?: string;
    taskCode?: string;
    taskType?: string;
    status?: string;
    dateRange?: [string, string];
  }

  // 供应商评价任务请求参数
  export interface TaskRequest {
    id?: string;
    taskName: string;
    taskCode: string;
    taskType: string;
    templateId: string;
    startTime: string;
    endTime: string;
  }

  // 供应商评价结果类型定义
  export interface EvaluateTaskRequest {
    basePageRequest: BasePageRequest;
    isAnswer?: number;
    userId?: string;
    evaluateTheme?: string;
    status?: string;
    startTime?: string;
    endTime?: string;
    [property: string]: any;
  }

  export interface EvaluateTaskData {
    countId: null;
    current: number;
    hitCount: boolean;
    maxLimit: null;
    optimizeCountSql: boolean;
    orders: any[];
    pages: number;
    records: EvaluateTaskRecord[];
    searchCount: boolean;
    size: number;
    total: number;
    [property: string]: any;
  }

  export interface EvaluateTaskRecord {
    basePageRequest?: null;
    endTime?: string;
    evaluateTheme?: string;
    id?: string;
    startTime?: string;
    status?: string;
    statusName?: string;
    tenantName?: string;
    userId?: null;
    taskName?: string;
    taskCode?: string;
    taskType?: string;
    createBy?: string;
    createTime?: string;
    updateBy?: string;
    updateTime?: string;
    [property: string]: any;
  }

  export interface EvaluateTaskSearchParams {
    evaluateTheme?: string;
    status?: string;
    timeRange?: [string, string];
    [property: string]: any;
  }

  // 供应商评价结果详情查询请求
  export interface EvaluateSupplierRequest {
    basePageRequest: BasePageRequest;
    evaluateTaskId: string;
    isAnswer?: number;
    supplierName?: string;
    level?: string;
    [property: string]: any;
  }

  // 供应商评价结果详情响应数据
  export interface EvaluateSupplierData {
    countId: null;
    current: number;
    hitCount: boolean;
    maxLimit: null;
    optimizeCountSql: boolean;
    orders: any[];
    pages: number;
    records: EvaluateSupplierRecord[];
    searchCount: boolean;
    size: number;
    total: number;
    [property: string]: any;
  }

  // 供应商评价结果详情记录
  export interface EvaluateSupplierRecord {
    basePageRequest: null;
    createBy: string;
    createDate: null;
    createTime: string;
    deleteFlag: null | string;
    delFlag: string;
    evaluateTaskId: string;
    id: string;
    lastUpdateTime: null | string;
    reviewResult: null | string;
    reviewScore: null | number;
    supplierId: string;
    tenantId: null;
    tenantName: null;
    updateBy: string;
    updateDate: null;
    updateTime: string;
    supplierName?: string; // 供应商名称
    category?: string;     // 品类
    level?: string;        // 评价等级
    score?: number;        // 评价得分
    [property: string]: any;
  }

  // 供应商评价结果详情查询参数
  export interface EvaluateSupplierSearchParams {
    evaluateTaskId?: string;
    supplierName?: string;
    level?: string;
    [property: string]: any;
  }

  // 供应商评价打分情况请求
  export interface EvaluateScoreRequest {
    basePageRequest: BasePageRequest;
    taskId: string;
    supplierId: string;
    [property: string]: any;
  }

  // 供应商评价打分情况响应数据
  export interface EvaluateScoreData {
    categoryId: null;
    categoryLimitation: string;
    createBy: null;
    createDate: null;
    createTime: null;
    deleteFlag: null;
    delFlag: string;
    deptId: null;
    endTime: string;
    evaluateTheme: string;
    evaluateYear: string;
    id: string;
    indicatorList: EvaluateScoreIndicator[];
    lastUpdateTime: null;
    startTime: string;
    status: string;
    supplierIds: EvaluateSupplierId[];
    templateId: string;
    tenantId: null;
    tenantName: null;
    updateBy: null;
    updateDate: null;
    updateTime: null;
    weightDept: null;
    weightStatus: string;
    weightValue: null;
    [property: string]: any;
  }

  // 评价指标列表
  export interface EvaluateScoreIndicator {
    indicatorIds: null[];
    type: string;
    userId: string;
    userName?: string;
    evaluateUnit?: string;
    evaluateTime?: string;
    score?: string | number;
    [property: string]: any;
  }

  // 供应商ID列表
  export interface EvaluateSupplierId {
    id: string;
    userIds: any[];
    supplierName?: string;
    category?: string;
    department?: string;
    socialCreditCode?: string;
    evaluators?: PersonnelItem[];
    evaluatorCount?: number;
    [property: string]: any;
  }

  // 供应商评价打分情况查询参数
  export interface EvaluateScoreSearchParams {
    supplierName?: string;
    evaluateUnit?: string;
    level?: string;
    [property: string]: any;
  }

  // 供应商评价打分详情查询请求
  export interface EvaluateScoreDetailRequest {
    id: string;
    [property: string]: any;
  }

  // 供应商评价打分详情响应数据
  export interface EvaluateScoreDetailData {
    taskIndicatorVo?: {
      baseIndicator: string; // 一级指标名称
      indicatorDesc?: string; // 指标说明
      score: string; // 一级指标分值
      subIndicator?: {
        id: string; // 二级指标ID
        subIndicator: string; // 二级指标名称
        subScore: string; // 二级指标分值
        starIndicator?: string; // 是否星号项
        scoreNum?: string; // 实际得分
        remark?: string; // 评分说明
      }[];
    }[];
    // 其他字段...
  }

  // 评价指标数据
  export interface TaskIndicatorVo {
    baseIndicator: string;
    indicatorDesc: string;
    score: string;
    subIndicator: SubIndicator[];
    [property: string]: any;
  }

  // 二级指标数据
  export interface SubIndicator {
    id: string;
    remark: null;
    scoreNum: null;
    starIndicator: string;
    stId: string;
    subIndicator: string;
    subScore: string;
    [property: string]: any;
  }

  // 评价规则相关类型定义
  export interface EvaluateRuleResponse {
    code: number;
    data: EvaluateRuleItem[];
    message: string;
    success: boolean;
    [property: string]: any;
  }

  export interface EvaluateRuleDetailResponse {
    code: number;
    data: EvaluateRuleItem;
    message: string;
    success: boolean;
    [property: string]: any;
  }

  export interface EvaluateRuleItem {
    beginValue: string;
    createBy: string;
    createDate: null;
    createTime: string;
    deleteFlag: null;
    delFlag: string;
    endValue: string;
    id: string;
    lastUpdateTime: null;
    levelName: string;
    remark: string;
    ratingName?: string;
    tenantId: null;
    tenantName: null;
    updateBy: string;
    updateDate: null;
    updateTime: string;
    [property: string]: any;
  }

  export interface EvaluateRuleAddRequest {
    /**
     * 阈值起始区间值
     */
    beginValue: string;
    /**
     * 阈值截至区间值
     */
    endValue: string;
    /**
     * 等级名称（A、B、C...）
     */
    levelName: string;
    /**
     * 评级名称(优秀供应商、良好供应商、应辅导供应商、应淘汰供应商)
     */
    ratingName: string;
    /**
     * 备注
     */
    remark?: string;
    [property: string]: any;
  }

  export interface EvaluateRuleUpdateRequest {
    /**
     * 规则ID
     */
    id: string;
    /**
     * 阈值起始区间值
     */
    beginValue: string | number;
    /**
     * 阈值截至区间值
     */
    endValue: string | number;
    /**
     * 等级名称（A、B、C...）
     */
    levelName: string;
    /**
     * 备注
     */
    remark?: string;
    [property: string]: any;
  }

  // 评价打分详情数据
  interface IndicatorDetailData {
    category: string;
    name: string;
    taskIndicatorVo: {
      baseIndicator: string;
      indicatorDesc: string;
      score: string;
      subIndicator: {
        id: string;
        remark: string | null;
        scoreNum: string | null;
        starIndicator: string;
        stId: string;
        subIndicator: string;
        subScore: string;
      }[];
    }[];
  }
}

// 供应商评价模块类型定义
declare namespace SupplierEvaluate {
  // 权重单位接口
  export interface WeightUnit {
    id: string;
    name: string;
    weight: number;
  }

  // 模板管理类型定义
  export type TemplateBasePageRequest = {
    pageNo: number;
    pageSize: number;
    [property: string]: any;
  }

  export type TemplateRequest = {
    basePageRequest: TemplateBasePageRequest;
    [property: string]: any;
  }

  export type TemplateResponse = {
    code: number;
    data: TemplateData;
    message: string;
    success: boolean;
    [property: string]: any;
  }

  export type TemplateData = {
    countId: null;
    current: number;
    hitCount: boolean;
    maxLimit: null;
    optimizeCountSql: boolean;
    orders: string[];
    pages: number;
    records: TemplateRecord[];
    searchCount: boolean;
    size: number;
    total: number;
    [property: string]: any;
  }

  export type TemplateRecord = {
    basePageRequest?: null;
    /**
     * 品类id
     */
    categoryId?: string;
    /**
     * 品类名称
     */
    categoryName?: string;
    /**
     * 创建时间
     */
    createTime?: string;
    /**
     * 部门名称
     */
    deptName?: string;
    /**
     * 模板id
     */
    id?: string;
    /**
     * 状态
     */
    status?: string;
    /**
     * 状态类型
     */
    statusName?: string;
    /**
     * 模板名称
     */
    templateName?: string;
    /**
     * 模板编号
     */
    templateCode?: string;
    /**
     * 模板类型
     */
    templateType?: string;
    /**
     * 创建单位
     */
    tenantName?: string;
    /**
     * 创建人
     */
    createBy?: string;
    /**
     * 更新人
     */
    updateBy?: string;
    /**
     * 更新时间
     */
    updateTime?: string;
    /**
     * 部门ID
     */
    deptId?: string;
    /**
     * 用于前端显示用 - 部门
     */
    department?: string;
    [property: string]: any;
  }

  // 模板搜索参数
  export type TemplateSearchParams = {
    templateName?: string;
    categoryId?: string;
    status?: string;
    tenantName?: string;
    dateRange?: [string, string];
    [property: string]: any;
  }

  // 模板详情响应
  export type TemplateDetailResponse = {
    code: number;
    data: TemplateDetail;
    message: string;
    success: boolean;
    [property: string]: any;
  }

  // 模板详情数据
  export type TemplateDetail = {
    categoryId: string;
    categoryLimitation: string;
    copyTemplateId: null;
    createBy: null | string;
    createDate: null | string;
    createTime: string;
    deleteFlag: null | string;
    delFlag: string;
    id: string;
    indicatorStList: IndicatorStItem[];
    lastUpdateTime: null | string;
    status: string;
    templateName: string;
    templateType: string;
    tenantId: null | string;
    tenantName: null | string;
    updateBy: null | string;
    updateDate: null | string;
    updateTime: string;
    [property: string]: any;
  }
// 模板列表项类型
export type TemplateItem = {
  categoryId?: string;
  categoryLimitation?: string;
  copyTemplateId?: null;
  createBy?: string;
  createDate?: null;
  createTime?: string;
  deleteFlag?: null;
  delFlag?: string;
  id: string;
  lastUpdateTime?: null;
  status?: string;
  templateName?: string;
  templateType?: string;
  tenantId?: null;
  tenantName?: null;
  updateBy?: string;
  updateDate?: null;
  updateTime?: string;
  [property: string]: any;
};
  // 一级指标项
  export type IndicatorStItem = {
    baseIndicator: string;
    createBy: string;
    createDate: null | string;
    createTime: string;
    deleteFlag: null | string;
    delFlag: string;
    descIndicator: string;
    id: string;
    indicatorNdList: IndicatorNdItem[];
    lastUpdateTime: null | string;
    orderBy: string;
    score: string;
    templateId: string;
    tenantId: null | string;
    tenantName: null | string;
    updateBy: string;
    updateDate: null | string;
    updateTime: string;
    [property: string]: any;
  }

  // 二级指标项
  export type IndicatorNdItem = {
    createBy: string;
    createDate: null | string;
    createTime: string;
    deleteFlag: null | string;
    delFlag: string;
    id: string;
    indicatorStId: string;
    isStar: string;
    lastUpdateTime: null | string;
    orderBy: string;
    score: string;
    subIndicator: string;
    templateId: string;
    tenantId: null | string;
    tenantName: null | string;
    updateBy: string;
    updateDate: null | string;
    updateTime: string;
    [property: string]: any;
  }

  // 模板添加/更新参数
  export type TemplateSaveRequest = {
    id?: string;
    templateName: string;
    templateCode?: string;
    templateType: string;
    categoryId: string;
    deptId: string;
    status: string;
    [property: string]: any;
  }

  // 模板启用/禁用/删除参数
  export type TemplateStatusRequest = {
    id: string;
  }

  // 模板修改请求参数
  export type TemplateUpdateRequest = {
    categoryId: string;
    categoryLimitation: string;
    id: string;
    indicatorStList: TemplateUpdateIndicatorStItem[];
    status: number;
    templateName: string;
    templateType: string;
    [property: string]: any;
  }

  // 修改请求一级指标项
  export type TemplateUpdateIndicatorStItem = {
    baseIndicator: string;
    descIndicator: string;
    indicatorNdList: TemplateUpdateIndicatorNdItem[];
    orderBy: number;
    score: string;
    [property: string]: any;
  }

  // 修改请求二级指标项
  export type TemplateUpdateIndicatorNdItem = {
    isStar: string;
    orderBy: number;
    score: string;
    subIndicator: string;
    [property: string]: any;
  }

  // 模板新增请求参数
  export type TemplateAddRequest = {
    /**
     * 品类id(cosco_category表主键)
     */
    categoryId: string;
    /**
     * 品类限制类型（0.通用不限品类、1.限制品类）
     */
    categoryLimitation: string;
    /**
     * 二级指标是否可增加
     */
    indicatorNdMore: string;
    indicatorStList: TemplateAddIndicatorStItem[];
    /**
     * 一级指标是否可增加
     */
    indicatorStMore: string;
    /**
     * 是否可增加对应指标类型(数据字典 通用指标、技术指标)
     */
    indicatorTypeMore: string;
    /**
     * 是否启用(0.草稿、1.启用、2.禁用)
     */
    status: number;
    /**
     * 模板名称
     */
    templateName: string;
    /**
     * 评价模板类型(数据字典code)
     */
    templateType: string;
    [property: string]: any;
  }

  // 新增请求一级指标项
  export type TemplateAddIndicatorStItem = {
    /**
     * 基本指标
     */
    baseIndicator: string;
    /**
     * 基本指标是否可编辑(0.是、1.否)
     */
    baseIndicatorEdit: string;
    /**
     * 指标说明
     */
    descIndicator: string;
    /**
     * 指标说明是否可编辑(0.是、1.否)
     */
    descIndicatorEdit: string;
    indicatorNdList: TemplateAddIndicatorNdItem[];
    /**
     * 该一级指标是否可编辑(0.是、1.否)
     */
    indicatorStEdit: string;
    /**
     * 指标类型(数据字典 通用指标、技术指标)
     */
    indicatorType: string;
    /**
     * 排序
     */
    orderBy: number;
    /**
     * 分值
     */
    score: string;
    /**
     * 分值是否可编辑(0.是、1.否)
     */
    scoreEdit: string;
    [property: string]: any;
  }

  // 新增请求二级指标项
  export type TemplateAddIndicatorNdItem = {
    /**
     * 细分指标是否可编辑(0.是、1.否)
     */
    baseIndicatorEdit: string;
    /**
     * 该一级指标是否可编辑(0.是、1.否)
     */
    indicatorNdEdit: string;
    /**
     * 是否设置星号项(0.否、1.是)
     */
    isStar: string;
    /**
     * 星号项是否可编辑(0.是、1.否)
     */
    isStarEdit: string;
    /**
     * 排序
     */
    orderBy: number;
    /**
     * 分值
     */
    score: string;
    /**
     * 分值是否可编辑(0.是、1.否)
     */
    scoreEdit: string;
    /**
     * 细分指标
     */
    subIndicator: string;
    [property: string]: any;
  }

  // 品类树接口返回类型
  export type CategoryTreeResponse = {
    code: number;
    data: CategoryTreeItem[];
    message: string;
    success: boolean;
    [property: string]: any;
  }

  export type CategoryTreeItem = {
    ancestors?: string;
    basePageRequest?: null;
    /**
     * 品类名称
     */
    categoryName?: string;
    children?: CategoryTreeChild[];
    createBy?: string;
    createTime?: string;
    delFlag?: string;
    id?: string;
    lastUpdateTime?: null;
    /**
     * 排序
     */
    orderBy?: string;
    /**
     * 父级id
     */
    parentId?: string;
    remark?: null;
    /**
     * 类型，0分类 1品类
     */
    type?: string;
    updateBy?: null;
    updateTime?: null;
    [property: string]: any;
  }

  export type CategoryTreeChild = {
    ancestors: string;
    basePageRequest: null;
    categoryName: string;
    children: CategoryTreeGrandChild[] | null;
    createBy: string;
    createTime: string;
    delFlag: string;
    id: string;
    lastUpdateTime: null;
    orderBy: string;
    parentId: string;
    remark: null;
    type: string;
    updateBy: null | string;
    updateTime: null | string;
    [property: string]: any;
  }

  export type CategoryTreeGrandChild = {
    ancestors?: string;
    basePageRequest?: null;
    categoryName?: string;
    children?: null;
    createBy?: string;
    createTime?: string;
    delFlag?: string;
    id?: string;
    lastUpdateTime?: null;
    orderBy?: string;
    parentId?: string;
    remark?: null;
    type?: string;
    updateBy?: null;
    updateTime?: null;
    [property: string]: any;
  }
}
