import { BaseResponse } from "@/app/[name]/(Main)/types/Types";
import { ServiceArea } from "@/app/[name]/(Dialogs)/order/checkout/types/Types";

export interface HistoryOrderUser {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  firstName: string;
  lastName: string;
  phone: string;
  birthDate: string;
  marriageDate: string;
  referrer: string | null;
  isActive: boolean;
  gender: boolean;
  wallet: number;
  points: number;
}

export interface HistoryOrderRestaurant {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  name: string;
  slug: string;
  logo: string | null;
  address: string | null;
  menuColor: string | null;
  latitude: number | null;
  longitude: number | null;
  serviceArea: ServiceArea;
  isActive: boolean;
  establishedYear: number | null;
  phoneNumber: string | null;
  phone: string;
  instagram: string | null;
  telegram: string | null;
  whatsapp: string | null;
  description: string | null;
  seoTitle: string | null;
  seoDescription: string | null;
  tagNames: string | null;
  images: string | null;
  vat: number;
  domain: string;
}

export interface HistoryOrderDeliveryMethod {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  title: string;
  method: "dineIn" | "pickup" | "deliveryCar" | "deliveryCourier";
  restaurant: string;
  deliveryFee: number;
  minOrderPrice: number;
  description: string;
  enabled: boolean;
  order: number;
}

export interface HistoryOrderAddress {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  user: string;
  title: string;
  address: string;
  city: string;
  province: string;
  postalCode: string;
  latitude: number;
  longitude: number;
  phone: string;
  isDefault: boolean;
}

export interface HistoryOrderPaymentMethod {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  restaurant: string;
  title: string;
  method: "CardOnDelivery" | "Cash" | "Online";
  gateway: string | null;
  description: string;
  enabled: boolean;
  order: number;
  merchantId: string | null;
}

export interface HistoryOrderFood {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  restaurant: string;
  category: string;
  title: string;
  desc: string | null;
  content: string | null;
  price: number;
  points: number | null;
  order: number | null;
  prepareTime: number | null;
  sat: boolean;
  sun: boolean;
  mon: boolean;
  breakfast: boolean;
  noon: boolean;
  dinner: boolean;
  stock: number;
  stockDefault: number;
  isActive: boolean;
  images: string[] | null;
  inPlaceServe: boolean;
  pickupServe: boolean;
  rate: number;
  discount: number;
}

export interface HistoryOrderItem {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  order: string;
  food: HistoryOrderFood;
  quantity: number;
  unitPrice: number;
  discount: number;
  totalPrice: number;
}

export interface HistoryOrder {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  user: HistoryOrderUser;
  restaurant: HistoryOrderRestaurant;
  deliveryMethod: HistoryOrderDeliveryMethod;
  address: HistoryOrderAddress | null;
  paymentMethod: HistoryOrderPaymentMethod;
  orderNumber: number;
  couponDiscount: number;
  itemsDiscount: number;
  totalDiscount: number;
  subTotal: number;
  tax: number;
  shipmentFee: number;
  total: number;
  totalItems: number;
  status: string;
  paymentStatus: string;
  items: HistoryOrderItem[];
}

export type OrdersResponse = BaseResponse<HistoryOrder[]>;

