export type OrderResourcesType = {
  date: number;
  type: string;
  category: string;
  reference: string;
  id: number;
  created_at: Date;
  updated_at: Date;
};
export interface TableColumn {
  key: string;
  label: string;
  alwaysVisible?: boolean;
}
export interface TableBodyVal {
  date: string;
  description: string;
  amount: string;
  status: {
    res: string;
    returnStatus: string;
  };
}
export type OrderActionsType =
  | 'add-resources'
  | 'split-order'
  | 'bulk-update'
  | 'log-service-refusal'
  | 'cancel-order'
  | 'confirm-order'
  | 'product-action'
  | 'send-sms'
  | 'send-email'
  | 'change-customer-account'
  | 'escalations'
  | 'create-task'
  | 'create-reminder'
  | 'log-feedback'
  | 'hold-order'
  | 'unhold-order'
  | 'charge-log'
  | 'restore-products'
  | 'qclogtable'
  | 'images-popup'
  | 'qclog'
  | 'view-reminder'
  | 'order-lock'
  | 'view-flag'
  | 'release-order'
  | 'unrelease-order'
  | 'clear-date'
  | 'uncancel-order'
  | 'remove-from-route';

export interface ChargeLogData {
  id: number;
  date: string;
  description: string;
  amount: string;
  status: string;
}
export interface Column {
  key: string;
  title: string;
  dataIndex?: string;
  render?: (record: any) => React.ReactNode;
}

// ORDER TYPES
export type OrderRecipientType = {
  id?: number | null;
  order_id?: number | null;
  recipient_name?: string | null;
  address?: string | null;
  postcode?: string | null;
  postcode_district?: string | null;
  postcode_short?: string | null;
  latitude?: number | null;
  longitude?: number | null;
  what_3words_address?: string | null;
  contact_home?: string | null;
  contact_work?: string | null;
  contact_mobile?: string | null;
  contact_email?: string | null;
  is_comms_enabled?: boolean | null;
};

export interface OrderServicesDetailType {
  order_id: number | null;
  timed_service_id: number | null;
  order_delivery_point_id: number | null;
  order_service_level_id: number | null;
  heavy_order: boolean | null;
  heavy_item: boolean | null;
  bulky_order: boolean | null;
  bulky_item: boolean | null;
  id: number | null;
}

export interface OrderServiceType {
  order_id?: number | null;
  order_service_list_id?: number | null;
  service_time?: any | null;
  is_refused?: boolean | null;
  service_note?: string | null;
  id?: number | null;
  service_category_id?: number;
  is_deleted?: boolean;
  new_id?: number; // only required while creating new service
}

export interface OrderRouteType {
  id?: number;
  order_id?: number;
  route_id?: number;
  drop_no?: number;
  // drop_time?: number;
  slot?: string;
  slot_date?: string;
  slot_fixed?: string;
  est_arrival?: string;
  est_departure?: string;
  // delivery_instructions?: string;
  complete_time?: string;
  complete_notes?: string;
  signee?: string;
  feedback_received?: boolean;
  is_active?: boolean;
}
export interface OrdersType {
  depot_id: number | null;
  gsit_order_id: number | null;
  customer_id: number | null;
  trading_name: string | null;
  recipient_reference: string | null;
  order_locked: boolean | null;
  lock_notes?: any | null;
  order_type_id?: number | null;
  allow_live_tracking?: any | null;
  weight: number | null;
  cube: number | null;
  rescheduled: boolean | null;
  zone_code: string | null;
  status: string | null;
  order_status_note: string | null;
  print_pod: boolean | null;
  order_number: string | null;
  consignment: string | null;
  action_date: Date | string | null;
  other_instructions: string | null;
  schedule_after?: any | null;
  vehicle_type: string | null;
  order_recipient: OrderRecipientType | null;
  order_services_detail: OrderServicesDetailType | null;
  order_services: OrderServiceType[];
  order_routes?: OrderRouteType | null;
  order_eta_updates: any[];
  order_delivery_declined_dates: any[];
  order_communications: any[];
  id: number | null;
  status_value: string | null;
  name: string;
  order_locked_by: string | null;
  delivery_instructions: string | null;
  drop_time: string | null;
  created_by: any;
  created_at: any;
  recipient_name: any;
  postcode: any;
  carrier_id: number | null;
}

export type DeleteProds = {
  id: number | null | undefined;
  order_id: number;
};

export interface ApiResponse {
  message: string;
  code: number;
  error: string | null;
  error_traceback: string | null;
  data: any;
  location_name: any;
}

export interface CreateProduct {
  code: string;
  description: string;
  sku: string;
  weight: number | null;
  cube: number | null;
  order_id: number | null;
  order_product_type_id: number | null;
  return_reason_id: number | null;
  collection_reason_id: number | null;
  product_return_action_id: number | null;
  return_location: string | null;
}

export interface UnRecieveOrderProduct {
  unrecieve_reason_id: number;
  unrecieve_note: string;
  // id: number
}

export interface UpdateOrderProduct {
  id: number;
  order_id: number;
  product_type_id?: number;
  order_product_type_id?: number;
  product_return_action_id?: number;
  return_location?: string;
  return_reason_id?: number;
  collection_reason_id?: number;
}

export type CustomersType = {
  client_id: number;
  shared_id_list: string;
  customer_name: string;
  trading_as: string;
  account_number: string;
  company_name: any;
  parent_id: number;
  gsit_customer_id: number;
  comms_name: any;
  status: boolean;
  fax: any;
  api_customer: any;
  api_key: string;
  events_path: any;
  api_ip_whitelist: any;
  review_date: any;
  account_type_id: number;
  injection_type_id: any;
  injection_method_id: any;
  injection_days: any;
  eta_alert_comms_to_customer: any;
  allow_live_tracking: boolean;
  amazon_tracking_enabled: boolean;
  tracking_domain: string;
  tracking_order_identifier_id: number;
  restricted_verification_id: any;
  id: number;
  uuid: string;
  customer_address_book: any[];
  customer_phone_book: any[];
  customer_emails: any[];
  customer_default_services: any;
  service_level_configs: any[];
  review_service_enable_days: any[];
  customer_invoice_details: any;
  customer_retailer_details: any[];
  customer_order_services: any[];
  exceptional_days: any[];
  customer_users: any[];
};

export interface CancelOrderProductsType {
  order_product_id?: number;
  action?: string; // deliver/ return/ deallocate
  return_action?: string;
  return_reason?: string;
  // redundant fields
  code?: string;
  description?: string;
  sku?: string;
  product_type?: string;
  previous_product_type?: string;
}
