declare module 'slash2';
declare module '*.css';
declare module '*.less';
declare module '*.scss';
declare module '*.sass';
declare module '*.svg';
declare module '*.png';
declare module '*.jpg';
declare module '*.jpeg';
declare module '*.gif';
declare module '*.bmp';
declare module '*.tiff';
declare module 'omit.js';
declare module 'file-saver' {
  export function saveAs(data: Blob | File | string, filename?: string, options?: object): void;
}
// google analytics interface
interface GAFieldsObject {
  eventCategory: string;
  eventAction: string;
  eventLabel?: string;
  eventValue?: number;
  nonInteraction?: boolean;
}
interface Window {
  ga: (
    command: 'send',
    hitType: 'event' | 'pageview',
    fieldsObject: GAFieldsObject | string,
  ) => void;
  reloadAuthorized: () => void;
}

declare let ga: Function;

declare interface Window {
  ntkoBrowser: any;
}

// preview.pro.ant.design only do not use in your production ;
// preview.pro.ant.design 专用环境变量，请不要在你的项目中使用它。
declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefined;

declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;

declare const REQUEST_BASE: string;
declare const UPLOAD_URL: string;
declare const SERVER_BASE: string;

declare namespace API {
  // ... 其他类型定义

  // 通用响应类型
  type Result<T = any> = {
    code: number;
    msg: string;
    data: T;
  };

  // 分页查询参数
  type PageParams = {
    current?: number;
    pageSize?: number;
  };

  // 分页响应数据
  type PageResult<T = any> = {
    list: T[];
    pagination: {
      total: number;
      pageSize: number;
      current: number;
    };
  };
}

declare namespace SupplierEvaluate {
  // 模板管理相关类型
  interface TemplateRecord {
    id: string;
    templateName: string;
    templateType: string;
    category?: string;
    status?: string;
    canAddLevel1?: boolean;
    canAddLevel2?: boolean;
    canAddGeneral?: boolean;
    [key: string]: any;
  }

  type TemplateSearchParams = {
    templateName?: string;
    status?: string;
    createBy?: string;
    category?: string;
    dateRange?: string[];
  };

  // 任务管理相关类型
  type TaskRecord = {
    id: string;
    key: string;
    taskName: string;
    taskCode: string;
    taskType: string;
    templateName: string;
    status: string;
    startTime: string;
    endTime: string;
    createBy: string;
    createTime: string;
    updateBy?: string;
    updateTime?: string;
    // 接口返回的字段
    evaluateTheme?: string;
    statusName?: string;
    tenantName?: string;
  };

  type TaskSearchParams = {
    taskName?: string;
    status?: string;
    dateRange?: string[];
    evaluateTheme?: string;
  };

  // 评价结果相关类型
  type EvaluateResultRecord = {
    id: string;
    key: string;
    taskName: string;
    taskCode: string;
    taskType: string;
    status: string;
    startTime: string;
    endTime: string;
    createBy: string;
    createTime: string;
    updateBy?: string;
    updateTime?: string;
    supplierCount?: number;
    approvalStatus?: string;
  };

  type EvaluateResultSearchParams = {
    taskName?: string;
    status?: string;
    approvalStatus?: string;
    dateRange?: string[];
  };

  // 评价结果详情相关类型
  type EvaluateResultDetailRecord = {
    id: string;
    key: string;
    supplierName: string;
    category: string;
    score: number;
    level: string;
  };

  type EvaluateResultDetailSearchParams = {
    supplierName?: string;
    level?: string;
  };

  // 评价得分明细相关类型
  type ScoreDetailItem = {
    key: string;
    index: number;
    itemName: string;
    weight: number;
    score: number;
    weightedScore: number;
    remark?: string;
  };

  // 评价打分情况列表相关类型
  type ScoreListRecord = {
    id: string;
    key: string;
    supplierName: string;
    category: string;
    evaluateUnit: string;
    evaluator: string;
    evaluateTime: string;
    score: number;
  };

  type ScoreListSearchParams = {
    supplierName?: string;
    level?: string;
  };

  // 审批相关类型
  type ApprovalRecord = {
    id: string;
    key: string;
    evaluateTitle: string;
    evaluateCategory: string;
    initiatingUnit: string;
    applyTime: string;
    processStatus: string;
    approvalResult: string;
  };

  type ApprovalSearchParams = {
    evaluateTitle?: string;
    processStatus?: string;
    approvalResult?: string;
    timeRange?: [string, string];
  };

  type ApprovalHistoryRecord = {
    id: string;
    operator: string;
    action: string;
    comment: string;
    time: string;
  };

  type ApprovalFormValues = {
    approvalResult: string;
    comment: string;
  };

  // 供应商评价数据类型
  type SupplierEvaluationRecord = {
    id: string;
    key?: string;
    supplierName: string;
    category: string;
    score: number;
    level: string;
    evaluator: string;
    evaluateTime: string;
  };

  // 从EvaluateTemplateTable组件移动过来的类型定义
  export interface IndicatorNdItem {
    /**
     * 细分指标是否可编辑(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;
    /**
     * 二级指标ID（修改时需要）
     */
    id?: string;
    /**
     * 描述
     */
    desc?: string;
    [property: string]: any;
  }

  export interface IndicatorStItem {
    /**
     * 基本指标
     */
    baseIndicator: string;
    /**
     * 基本指标是否可编辑(0.是、1.否)
     */
    baseIndicatorEdit?: string;
    /**
     * 指标说明
     */
    descIndicator: string;
    /**
     * 指标说明是否可编辑(0.是、1.否)
     */
    descIndicatorEdit?: string;
    indicatorNdList: IndicatorNdItem[];
    /**
     * 该一级指标是否可编辑(0.是、1.否)
     */
    indicatorStEdit?: string;
    /**
     * 指标类型(数据字典 通用指标、技术指标)
     */
    indicatorType: string;
    /**
     * 排序
     */
    orderBy: number;
    /**
     * 分值
     */
    score: string;
    /**
     * 分值是否可编辑(0.是、1.否)
     */
    scoreEdit?: string;
    /**
     * 一级指标ID（修改时需要）
     */
    id?: string;
    [property: string]: any;
  }

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

  export interface TemplateUpdateRequest {
    categoryId: string;
    categoryLimitation: string;
    id: string;
    indicatorStList: IndicatorStItem[];
    status: number;
    templateName: string;
    templateType: string;
    [property: string]: any;
  }

  // 评价任务请求和响应类型
  interface BasePageRequest {
    pageNo: number;
    pageSize: number;
    [property: string]: any;
  }

  interface TaskRequest {
    basePageRequest: BasePageRequest;
    isAnswer?: number;
    [property: string]: any;
  }

  interface TaskResponse {
    code: number;
    data: {
      countId: null;
      current: number;
      hitCount: boolean;
      maxLimit: null;
      optimizeCountSql: boolean;
      orders: string[];
      pages: number;
      records: {
        basePageRequest?: null;
        endTime?: string;
        evaluateTheme?: string;
        id?: string;
        startTime?: string;
        status?: string;
        statusName?: string;
        tenantName?: string;
        [property: string]: any;
      }[];
      searchCount: boolean;
      size: number;
      total: number;
      [property: string]: any;
    };
    message: string;
    success: boolean;
    [property: string]: any;
  }

  // 评价任务新增接口类型
  interface TaskIndicatorList {
    /**
     * 指标id集合
     */
    indicatorIds?: string[];
    /**
     * 评价类型(0 按评价单  1 按指标)
     */
    type: number;
    /**
     * 用户id
     */
    userId: string;
    [property: string]: any;
  }

  interface TaskSupplierId {
    /**
     * 供应商id
     */
    id: string;
    /**
     * 用户集合
     */
    userIds: string[];
    [property: string]: any;
  }

  interface TaskDeptWeight {
    /**
     * 权重分配部门
     */
    weightDept?: string;
    /**
     * 权重比例值
     */
    weightValue?: string;
    [property: string]: any;
  }

  interface TaskAddRequest {
    /**
     * 品类限制类型（0.通用不限品类、1.限制品类）
     */
    categoryLimitation: string;
    /**
     * 评价结束时间
     */
    endTime: string;
    /**
     * 评价主题
     */
    evaluateTheme: string;
    /**
     * 评价年度
     */
    evaluateYear: string;
    /**
     * 指标分配列表
     */
    indicatorList: TaskIndicatorList[];
    /**
     * 评价开始时间
     */
    startTime: string;
    /**
     * 供应商列表
     */
    supplierIds: TaskSupplierId[];
    /**
     * 部门权重列表
     */
    taskDeptWeightList: TaskDeptWeight[];
    /**
     * 评价表模板id(cosco_evaluate_template表主键)
     */
    templateId: string;
    /**
     * 权重启用状态(0.不启用、1.启用)
     */
    // weightStatus: number;
    /**
   * 是否通知下级单位完善评价人及评价分工 0否1是
   */
    taskStatus: number | null;
    [property: string]: any;
  }

  interface TaskUpdateRequest {
    id: string;
    evaluateTheme: string;
    templateId: string;
    startTime: string;
    endTime: string;
    [property: string]: any;
  }

  /**
   * 任务详情数据
   */
  interface TaskDetailData {
    categoryId: string | null;
    categoryLimitation: string | null;
    createBy: string | null;
    createDate: string | null;
    createTime: string | null;
    deleteFlag: string | null;
    delFlag: string;
    deptId: string | null;
    endTime: string | null;
    evaluateTheme: string | null;
    evaluateYear: string | null;
    id: string | null;
    indicatorList: {
      indicatorIds: string[];
      type: number;
      userId: string;
    }[] | null;
    lastUpdateTime: string | null;
    startTime: string | null;
    status: string;
    supplierIds: {
      id: string;
      userIds: string[];
    }[] | null;
    suppliers: {
      id: string;
      supplierName: string;
      socialCreditCode?: string;
      category?: string;
      department?: string;
      evaluators: {
        id: string;
        name: string;
        department: string;
        position?: string;
      }[];
      [key: string]: any;
    }[] | null;
    templateId: string | null;
    tenantId: string | null;
    tenantName: string | null;
    updateBy: string | null;
    updateDate: string | null;
    updateTime: string | null;
    weightDept: string | null;
    weightStatus: number | null;
    weightValue: string | null;
    taskDeptWeightList: {
      weightDept: string;
      weightValue: string;
    }[] | null;
    [property: string]: any;
  }

  /**
   * 任务详情响应
   */
  interface TaskDetailResponse {
    code: number;
    data: TaskDetailData;
    message: string;
    success: boolean;
    [property: string]: any;
  }
}

declare module '*.css';
declare module '*.less';
declare module '*.png';
declare module '*.jpg';
declare module '*.jpeg';
declare module '*.gif';
declare module '*.bmp';
declare module '*.tiff';
declare module '*.svg' {
  export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement;
  const url: string;
  export default url;
}

declare module 'slash2';
declare module '*.json';
declare module 'react-copy-to-clipboard';
declare module 'react-fittext';
declare module '@antv/data-set';
declare module 'nzh/cn';
declare module 'webpack-theme-color-replacer';
declare module 'webpack-theme-color-replacer/client';
