import { Method } from 'axios';
import { Request } from 'express';
import { ObjectId } from 'mongoose';

export interface Info {
  [key: string]: string | boolean | ObjectId;
}

export interface ICompanyInfo {
  companyName: string;
  rcNumber: string;
  email: string;
  phoneNumber: string;
  address: string;
}

export interface IUserInfo {
  // _id: ObjectId;
  company_id: ObjectId;
  company_name: string;
  firstName: string;
  lastName: string;
  isCompany: boolean;
  role_id: ObjectId;
  isActive: boolean;
  userType: string;
  email: string;
  password: string;
  phoneNumber: string;
  address?: string;
  noOfAssignedOrders?: number;
  noOfCompletedOrders?: number;
  inTransit?: boolean;
  deviceTokens?: any;
}

export interface ISignUpUserInfo {
  company_id: ObjectId;
  company_name: string;
  firstName: string;
  lastName: string;
  isCompany: boolean;
  isActive: boolean;
  userType: string;
  email: string;
  password: string;
  phoneNumber: string;
}

export interface IRoleInfo {
  company_id: ObjectId;
  role: string;
  permissions: string[];
}
export interface IAssetInfo {
  company_id: ObjectId;
  assetName: string;
  regNo: string;
  idNo: string;
  assetStatus: boolean;
  assignedStatus: boolean;
  assignee: ObjectId;
}

export interface IPermissionInfo {
  slug: string;
  permissionType: string;
}

export interface IService {
  url: string;
  baseURL: string;
  method: Method;
  payload: Request;
}

interface ICoordinatesType {
  longitude: string;
  latitude: string;
}
export interface IAddressType {
  address: string;
  coordinates: ICoordinatesType;
}

interface IRouteInfo {
  orderType: string;
  orderInfo?: {
    customerName: string;
    phoneNumber: string;
    email: string;
    orderId: ObjectId;
    description: string;
  }[];
  address: IAddressType;
  distance?: number;
  duration?: number;
  adhocName?: string;
}

export interface IRoutePayLoad {
  startPoint: IRouteInfo;
  checkPoints: IRouteInfo[];
  endPoint: IRouteInfo;
}

export interface IUserData {
  company_id: ObjectId;
  _id: ObjectId;
  company_name: string;
  isCompany: boolean;
  userType: string;
  role_id: ObjectId | IRoleInfo;
  firstName: string;
  lastName: string;
  email: string;
}

export interface IUserDataEncrypt {
  company_id: ObjectId;
  _id: ObjectId;
  company_name: string;
  isCompany: boolean;
  userType: string;
  role_id: ObjectId | IRoleInfo;
  firstName: string;
  lastName: string;
  email: string;
  exp: number;
  iat: number;
}

export interface ReportType {
  company_id: ObjectId;
  routeId: ObjectId;
  dispatcher: string;
  startDate: string;
  endDate: string;
  expectedTime: string;
  actualTime: string;
  timeDifference: string;
}
