import { ICreator, IFile, IUpdater } from '@/api/common'
import { ElTableColumn } from 'element-ui/types/table-column'
import { ElUploadInternalFileDetail } from 'element-ui/types/upload'

export const base = '/survey'

export interface ColItem extends Partial<ElTableColumn> {
  _slot?: boolean
}
export interface IPagination {
  current?: number
  size?: number
  total?: number
}

export interface IDeviceType extends ICreator, IUpdater {
  id?: number
  dataUploadTime: number
  dictionaryId: number
  fileTypeID: number
  projectId: number
  deviceTypeName: string
  file: string
  projectName: string

  icon?: string
  iconFiles?: IFile[]
}

export interface IDeviceTypeParamDictionary extends ICreator, IUpdater {
  id: number
  isdel: number
  targetCode: string
  targetMax: number
  targetMin: number
  targetName: string
  targetUnit: string
  typeId: number
}
export interface IDeviceTypeDictionary extends ICreator, IUpdater {
  dataUploadTime: number
  deviceTypeName: string
  id: number
  isdel: number
}

export interface IDeviceTypeParam {
  id?: number
  dictionaryId: number
  isshow: number
  remark: string
  targetAlias: string
  targetCode: string
  targetName: string
  targetUnit: string
  typeId: number
  targetMin: number
  targetMax: number
}

export interface IStandard extends ICreator, IUpdater {
  id: number
  isdel: number
  isstart: number
  projectId: number
  projectName: string
  standardName: string
  typeId: number
  typeName: string
}

export interface IStandardParam extends ICreator, IUpdater {
  biginTime: string
  endTime: string
  id: number
  isdel: number
  isstart: number
  istidings: number
  lowTolerance: number
  lowerLimit: number
  sid: string
  standardId: number
  targetId: number
  targetName: string
  targetUnit: string
  upTolerance: number
  upperLimit: number
  warningLevel: number
  warningName: string
}

export interface IDevice extends ICreator, IUpdater {
  id?: number
  buyTime: string
  deviceFirm: string
  deviceModel: string
  deviceName: string
  deviceSn: string
  deviceType: number
  deviceTypeName: string
  fileTypeID: number
  filesPath: string
  firmLiaison: string
  liaisonPhone: string
  projectCode: string
  projectId: number
  projectName: string
  remark: string
  thumbnailFiles: string
  thumbnailUploadFiles: IFile[]
}

export interface IPoint extends ICreator, IUpdater {
  deviceId: number
  deviceName: string
  deviceSn: string
  deviceType: number
  deviceTypeName: string
  files: IFile[]
  groupByName: string
  id: number
  installId: number
  installPeople: string
  installTime: string
  isdismantle: number
  latitude: number
  liaisonPhone: string
  longitude: number
  partitionName: string
  sectionId: number
  siteAddress: string
  siteCode: string
  siteName: string
  siteState: number
  targets: string
  thumbnailFiles: IFile[]
  thumbnailUploadFiles: IFile[]
  uploadFiles: IFile[]
}

export interface ITeam extends ICreator, IUpdater {
  groupByCode: string
  groupByName: string
  id: number
  isdel: number
  projectId: number
  projectName: number
  remarks: string
  siteCount: number
  siteIds: number[]
}

export interface INeighbor extends ICreator, IUpdater {
  id: number
  siteId: number
  siteName: string
  deviceName: string
  deviceTypeName: string
  upperSiteId: number
  upperSiteName: string
  upperDeviceName: string
  upperDeviceTypeName: string
}
export interface ISection extends ICreator, IUpdater {
  coordinate: string
  id: number
  isdel: number
  partitionArea: number
  partitionCode: string
  partitionName: string
  pipeLength: number
  projectId: number
  projectName: string
  remarks: string
  siteIds: number
}

export interface IPointDetail {
  id?: number
  drainageId: number
  drainageName: string
  drainageRoadName: string
  drainageType: string
  latitude: number
  longitude: number
  projectCode: string
  projectId: number
  projectName: string
  sectionId: number
  siteAddress: string
  siteName: string
  typeId: number

  install: {
    deviceId: number
    fileTypeID: number
    installPeople: string
    installTime: string
    liaisonPhone: string
    relevancyState: number
    siteId: number
  }

  targets: {
    biginTime: string
    endTime: string
    isstart: number
    istidings: number
    lowTolerance: number
    lowerLimit: number
    targetId: number
    targetUnit: string
    upTolerance: number
    upperLimit: number
    warningLevel: number
    warningName: string
  }[]
  fileList: (string | Partial<ElUploadInternalFileDetail>)[]
}

export interface IPointDetailResult {
  id: number
  projectId: number
  siteCode: string
  siteName: string
  sectionId: number
  siteAddress: string
  longitude: number
  latitude: number
  drainageType: number
  drainageId: number
  drainageName: string
  drainageRoadName: string
  siteState: number
  psnodeVo: any
  installVo: {
    id: number
    deviceId: number
    siteId: number
    installPeople: string
    liaisonPhone: string
    installTime: string
    dismantleTime: string
    files: any
    uploadFiles: any
    thumbnailFiles: any
    thumbnailUploadFiles: any
    dismantlePeople: string
    dismantlePhone: string
    deviceName: string
    deviceCode: string
    deviceSn: string
    deviceType: number
    deviceTypeName: string
  }
  targetVos: {
    id: number
    sid: string
    typeId: number
    siteId: number
    targetId: number
    upperLimit: number
    upTolerance: number
    lowerLimit: number
    lowTolerance: number
    biginTime: string
    endTime: string
    warningLevel: number
    istidings: number
    isstart: number
    targetName: string
    targetUnit: string
    warningName: string
  }[]
  statuses: {
    id: number
    siteId: number
    siteName: string
    runState: number
    runStateName: string
    deviceId: number
    deviceName: string
    siteCode: string
    explain: string
    updateUser: number
    updateUserName: string
    updateTime: string
    isdel: number
    createUser: number
    createUserName: string
    createTime: string
  }[]
}
export interface IPointEnableParams {
  explain: string
  list: { deviceId: number; siteId: number }[]
  runState: number
  runStateName?: string
  updateTime: string
  updateUser: number
}

export interface IPointDismountParams {
  dismantlePeople: string
  dismantlePhone: string
  dismantleTime: string
  id: number
}
