import { DeviceType } from "@/store/device";
import {
  relicsLevelDesc,
  relicsTypeDesc,
  creationMethodDesc,
} from "@/store/relics";
import { SceneStatus } from "@/store/scene";
import { PointTypeEnum } from "drawing-board";

type UserInfoRoles = {
  roleId: number;
  roleKey: string;
  roleName: string;
};
export type UserInfo = {
  head: string;
  nickName: string;
  userName: string;
  roles: UserInfoRoles[];
  orgId: string;
  orgName?: string;
  userId?: number;
};

export type Relics = {
  address?: string;
  creationMethod?: keyof typeof creationMethodDesc;
  category?: keyof typeof relicsTypeDesc;
  createBy?: string;
  createTime?: string;
  level?: keyof typeof relicsLevelDesc;
  tbStatus?: 0;
  unicode?: string;
  updateBy?: null;
  relicsId: number;
  name: string;
};

export type ResPage<T> = {
  total: number;
  records: T[];
};

export type ResResult = {
  code: number;
  data: any;
  message: any;
  success: boolean;
  timestamp: string;
};
export type ScenePoint = {
  type: PointTypeEnum;
  tbStatus: number;
  createTime: string;
  updateTime: string;
  cameraType: DeviceType;
  index: number;
  id: number;
  uuid: number;
  name: string;
  remark: string;
  pos: [number, number, number] | [];
  location: [number, number, number];
  centerLocation: [number, number, number];
  sceneCode: string;
  sceneNum: string;
};

export type DefCtrlPoints = {
  defaultGisP1: [number, number];
  defaultGisP2: [number, number];
  defaultLocation1: [number, number, number];
  defaultLocation2: [number, number, number];
  panoId1: string;
  panoId2: string;
};

export type AutCtrlPoint = {
  ageControlLocation1: [number, number, number];
  ageControlLocation2: [number, number, number];
  gps84ControlCoordinate1: [number, number, number];
  gps84ControlCoordinate2: [number, number, number];
  gpsControlCoordinate1: [number, number, number];
  gpsControlCoordinate2: [number, number, number];
  gpsRaw1: [string, string, string];
  gpsRaw2: [string, string, string];
  roamingPointId1: string;
  roamingPointId2: string;
  epsg: string;
};
export type Dataset = {
  id: any;
  title: string;
  sceneName?: string;
  gfw: boolean;
  attachId?: string;
  sceneCode: string;
  time: any;
  color: string;
  sceneNum: string;
  location: [number, number, number];
  sceneVersion: "V3" | "V4";
  version: number;
  isCalibrated: boolean;
  orientation: number;
  shootTime: string;
  isItself: boolean;
  pointCount: number;
  status: number;
  from: string;
  plyExist: boolean;
  lasExist: boolean;
  objExist: boolean;
  e57Exist: boolean;
  file?: File;
  jobId?: string;
};

export type CtrlPoints = DefCtrlPoints & AutCtrlPoint & { status: number };

export type Scene = {
  id: number;
  sceneId: number;
  sceneCode: string;
  creationMethod?: keyof typeof creationMethodDesc;
  calcStatus?: SceneStatus;
  sceneName: string;
  title: string;
  cameraType: DeviceType;
  controlPoint: CtrlPoints;
  scenePos: ScenePoint[];
  algorithmTime: string;
  endTime: string;
  sceneSource: 0;
  datasets: Dataset[];
  snCode: string;
  startTime: string;
  userName: string;
};

export type Device = {
  cameraId: number;
  cameraSn: string;
  cameraType: DeviceType;
  createBy: string;
  createTime: string;
  deptId: number;
  fdCameraId: number;
  tbStatus: number;
  updateBy: string;
  updateTime: string;
  userId: 2;
  userName: string;
};
