import { PaginationParams } from "@dage/service";
import { IFileTemplateFormParams, YES_OR_NO } from ".";
import { ASS_INDEX_TYPE } from "./assessment";

/**
 * 发布状态
 */
export enum PUBLISH_ENUM {
  PENDING = 0,
  PUBLISHED = 1,
  ENDED = 2,
  EVALUATED = 3,
}

export interface IManageIndexDetail {
  id: number;
  name: string;
  remark: string;
  dateEnd: string;
  dateStart: string;
  status: PUBLISH_ENUM;
  score: null | number;
  type: ASS_INDEX_TYPE;
  updateTime: string;
  creatorName: string;
  createTime: string;
  jsonAdd: string;
  jsonSub: string;
  materials:
    | {
        id: number;
        name: string;
        fileName: string;
        filePath: string;
        suffix: string;
        isUpload: YES_OR_NO;
      }[]
    | null;
}

export interface IManageAssessmentIndex {
  id: number;
  score: number;
  level: number;
  isPoint: YES_OR_NO;
  fill: string;
  name: string;
}

/**
 * 自评状态
 */
export enum DEPT_STATUS_ENUM {
  /** 待填报 */
  PENDING_SUBMIT = 0,
  /** 待审核 */
  PENDING_EXAMINE = 1,
  /** 审核未通过 */
  EXAMINE_REJECT = 2,
  /** 审核通过(待评定) */
  EXAMINE_SUCCESS = 3,
  RETURN = 4,
  SUCCESS = 5,
}

export interface IManageFormListParams extends PaginationParams {
  deptStatus?: DEPT_STATUS_ENUM;
  searchKey?: string;
  status?: PUBLISH_ENUM;
  type?: ASS_INDEX_TYPE;
}

export interface IManageFormItem {
  id: number;
  name: string;
  type: ASS_INDEX_TYPE;
  remark: string;
  dateStart: string;
  dateEnd: string;
  publishStatus: PUBLISH_ENUM;
  deptName: string;
  deptStatus: DEPT_STATUS_ENUM;
}

export interface IManageFormDetail extends Omit<IManageIndexDetail, "status"> {
  deptStatus: DEPT_STATUS_ENUM;
}

export interface IManageDeptItem {
  id: number;
  name: string;
  levelMuseum: number;
  leaderName: string;
  remark: string;
  crewUserIds: string;
  isSelf: YES_OR_NO;
}

export interface IManageUserItem {
  id: number;
  isAdmin: YES_OR_NO;
  realName: string;
}

export interface IManageDeptMaterialItem
  extends Required<IFileTemplateFormParams> {
  id: number;
  deptId: null | number;
}

export interface IManageDeptAllocationOfIndexItem {
  perm: boolean;
  id: number;
  name: string;
  parentId: number;
  level: number;
  disabled?: boolean;
  children: IManageDeptAllocationOfIndexItem[];
}

export interface IManageRoleGroupItem {
  id: number;
  userName: string;
  userIds: string;
}

export interface IManageAssOperationResponse {
  gist: {
    one: number;
    two: number;
    three: number;
  };
}
