declare namespace Hazard {
  interface BaseEntity {
    id: number;
    createdDate: string;
    createUserId: string;
    createUserName: string;
    updatedDate?: string;
    updateUserId?: string;
    updateUserName?: string;
  }

  interface UserAssignment {
    toUserId: string;
    toUserName: string;
    toUserRemark?: string;
  }

  interface ImageAttachment {
    images: string[];
  }

  interface Handle extends BaseEntity {
    troubleId: number;
    content: string;
    images: string[];
    userId: string;
    userName: string;
    resolveDate: string;
    /**
     * 0: 治理未完成
     * 1: 治理完成
     */
    status: number;
  }

  interface ResolveParams {
    troubleId: number;
    images: string[];
    checkRemark: string;
    /**
     * 0: 待评价
     * 1: 合格
     * 2: 不合格
     */
    status: number;
  }

  interface Resolve extends BaseEntity, ImageAttachment {
    handles: Handle[];
    checkUserId: string;
    checkUserName: string;
    checkRemark: string;
    checkDate: string;
    /**
     * 0: 待评价
     * 1: 合格
     * 2: 不合格
     */
    status: number;
  }

  interface HazardPlan extends BaseEntity {
    measure: string;
    target: string;
    userId: string;
    userName: string;
    endDate: string;
    isUpdate: number;
  }

  interface HazardDto extends BaseEntity {
    company: string;
    department: number;
    title: string;
    level: string;
    type: string;
    riskType: number;
    riskCategory: number;
    riskPoint: number;
    riskPointTitle: string;
    content: string;
    // troublePosition: string;
    // position like dto fields
    position: number | undefined;
    positionNext: number | undefined;
    positionOther: string | undefined;
    positionType: string | undefined;
    line: number | undefined;
    // end: position like dto fields
    equipment: number;
    operation: number;
    images: string[];
    toDepartment: number;
    toUserId: string;
    toUserName: string;
    status: number;
    toUserRemark: string;
    checkUserId: string;
    checkUserName: string;
    checkDate: string;
    plan: HazardPlan;
    planCheckRemark: string;
    planCheckDate: string;
    planCheckUserId: string;
    planCheckUserName: string;
    planStatus: number;
    resolves: Resolve[];
    resolveStatus: number;
    resolveOvertime: number;
    /**
     * 隐患整体状态: 未审核，已审核，已拒绝，方案待审核，方案通过，方案驳回，治理中,治理结束，验收不合格，验收合格
     */
    finalStatus: string;
  }

  interface GetHazardsParams {
    company?: string;
    type?: number;
    finalStatus?: string;
    level?: string;
    title?: string;
    showMyList?: number;
    page: number;
    size: number;
    idList?: number[];
  }

  /**
   * 隐患排查计划执行记录
   */
  interface InspectionPlanHandleDto {
    /** 隐患排查计划执行ID */
    id: number;

    /** 第几次排查 */
    times: number;

    /** 隐患排查计划ID */
    troubleshootPlan: number;

    /** 发生地点类型 */
    positionType: string;

    /** 线路 */
    line?: number;

    /** 站点 */
    position: number;

    /** 站点2 */
    positionNext?: number;

    /** 站点其他 */
    positionOther?: string;

    /** 负责人ID */
    leaderUserId: string;

    /** 负责人姓名 */
    leaderUserName: string;

    /** 排查人数 */
    peopleNumber: number;

    /** 班组列表 */
    teams: number[];

    /** 排查目标列表 */
    targets: number[];

    /** 排查结果 - 是否异常 */
    checkAbnormal: number;

    /** 排查结果 - 工作情况 */
    checkWorkSituation: string;

    /** 排查结果 - 隐患列表 */
    checkOpinions?: ReportTaskHazard[];
  }

  /**
   * 排查计划轮次信息
   */
  interface InspectionPlanRound {
    /** 轮次ID */
    id: number;

    /** 排查部门列表 */
    departments: number[];

    /** 轮次序号 */
    round: number;

    /** 当前轮次总排查次数 */
    frequencyTimes: number;

    /** 开始时间 */
    startDate: string;

    /** 结束时间 */
    endDate: string;

    /** 排查计划填写记录 */
    handles: InspectionPlanHandleDto[];

    /** 状态:未填写/已填写/已完成等 */
    status: string;

    /** 更新时间 */
    updatedDate: string;

    /** 更新人ID */
    updateUserId: string;

    /** 更新人姓名 */
    updateUserName: string;
  }

  interface InspectionPlan extends BaseEntity {
    createUserDept: number;
    type: string;
    /** 状态: 未执行,制定中，已制定，已发布，执行中（有一条填报数据），已结束（所有数据都填报完成） */
    status: string;
    title: string;
    startDate: string;
    endDate: string;
    departments: number[];
    targets: number[];
    level: string;
    cycle: string;
    frequency: number;
    frequencyTimes: number;
    // time: string[];
    content: string;
    isUnited: boolean;
    status: string;
  }

  interface InspectionPlanDetail extends InspectionPlan {
    planTotalPeopleTimes?: number;
    plans: InspectionPlanRound[];
  }

  interface GetPlansParams {
    // company?: string;
    type?: string;
    startDate?: string;
    endDate?: string;
    page: number;
    size: number;
  }

  interface PlanListResponse {
    items: InspectionPlan[];
    total: number;
    troubleLevelNumber: {
      /** C类总数 */
      levelCTotal: number;
      /** B类总数 */
      levelBTotal: number;
      /** A类总数 */
      levelATotal: number;
      /** 重大总数 */
      levelImportantTotal: number;
    };
    troubleshootTypeNumber: {
      /** 其他总数 */
      typeOther: number;
      /** 日常隐患总数 */
      typeCommon: number;
      /** 专项总数 */
      typeSpecial: number;
    };
  }

  interface ReportTaskHazard {
    id?: number;
    troubleshootPlanHandleId: number;
    trouble: Partial<HazardDto>;
    /** 是否更新隐患 */
    troubleIsUpdate: number;
    /** 不符合状况或者治理意见是否更新了 */
    isUpdate: number;
    /** 是否删除隐患 */
    isDelete: number;
    situation: string;
    suggestion: string;
  }
  interface ReportTaskParams {
    id: number;
    checkAbnormal: number;
    checkWorkSituation: string;
    checkOpinions: ReportTaskHazard[];
  }

  interface CopyTasksToTurnParams {
    planId: number;
    roundId: number;
    fromTurnIndex: number;
    toTurnIndex: number;
  }
  interface CopyTasksToRoundParams {
    planId: number;
    fromRoundId: number;
    toRoundId: number;
  }
}
