/* eslint-disable @typescript-eslint/no-namespace */
import { Order } from '../landing';

import { ErrorMessage } from './common';
import { Master } from './master';

export namespace GetOrder {
  export type Response = Order.View;
  export type Params = {
    orderId: Order.Id;
  };
  export type Error = ErrorMessage;
}

export namespace CreateOrder {
  export type Response = {
    id: Order.Id;
  };
  export type Params = {
    body: Order.Create;
  };
}

export namespace UploadCarImage {
  export type Response = void;
  export type Params = {
    orderId: Order.Id;
    /**
     * @example { file: File }
     */
    body: FormData;
  };
}

type GetArrItemType<ArrType> =
  ArrType extends Array<infer ItemType> ? ItemType : never;

export const statuses = [
  'pending' as const,
  'progress' as const,
  'working' as const,
  'canceled' as const,
  'complete' as const,
];

export type Status = (typeof statuses)[number];

export type OrderArm = {
  carNumber?: string;
  startWashTime?: string;
  endWashTime?: string;
  orderDate?: string;
  status?: GetArrItemType<typeof statuses>;
  phone?: string;
  location?: string;
  master: Master;
  notes: '';
  allMasters: Master[];
  id: string;
};
