import { ALG, CheckSumWay } from '/@/views/operation/ota/config/packageDetail.config';

export interface GetOtaPackagesParams {
  pageSize: number;
  page: number;
  textSearch?: string;
  title?: string;
  sortOrder?: string;
  sortProperty?: string;
}

export interface CreateOtaPackagesParams {
  additionalInfo?: { description?: string };
  checksum?: Nullable<number>;
  checksumAlgorithm?: ALG;
  deviceProfileId?: {
    entityType?: string;
    id?: string;
  };
  isURL: boolean;
  tag?: string;
  title?: string;
  type?: CheckSumWay;
  url?: string;
  version?: string;
}

export interface UploadOtaPackagesParams {
  otaPackageId?: string;
  checksum?: string;
  checksumAlgorithm?: ALG;
  file?: FormData;
}

export interface Id {
  entityType: string;
  id: string;
}

export interface AdditionalInfo {
  description: string;
}

export interface IdRecord {
  entityType: string;
  id: string;
}

export interface OtaRecordDatum {
  id: Id;
  createdTime: any;
  additionalInfo: AdditionalInfo;
  tenantId: IdRecord;
  deviceProfileId: IdRecord;
  type: string;
  title: string;
  version: string;
  tag: string;
  url: string;
  hasData: boolean;
  fileName: string;
  contentType: string;
  checksumAlgorithm: string;
  checksum: string;
  dataSize?: number;
}

export interface TBResponse<T> {
  data: T[];
  totalPages: number;
  totalElements: number;
  hasNext: boolean;
}

export interface DefaultDeviceProfileInfo {
  id: {
    entityType: string;
    id: string;
  };
}

export interface CreateOtaPackageParams {
  title: string;
  version: string;
  tag: string;
  type: string;
  deviceProfileId: IdRecord;
  isURL: boolean;
  additionalInfo: AdditionalInfo;
}

export interface GetDeviceProfileInfosParams {
  pageSize?: number;
  page?: number;
  textSearch?: string;
  sortProperty?: string;
  sortOrder?: 'ASC' | 'DESC';
}

export interface DeviceProfileRecord {
  id: Id;
  name: string;
  image: string;
  defaultDashboardId?: any;
  type: string;
  transportType: string;
}
