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

export type BulkCartItem = {
  items: {
    foodId: string;
    quantity: number;
  }[];
};

export interface CartItem {
  foodId: string;
  foodTitle: string;
  quantity: number;
  price: number;
  discount: number;
  totalPrice: number;
}

export interface Coupon {
  couponId: string;
  couponName: string;
  couponCode: string;
}

export interface CartData {
  userId: string;
  restaurantId: string;
  restaurantName: string;
  items: CartItem[];
  deliveryFee: number;
  subTotal: number;
  itemsDiscount: number;
  couponDiscount: number;
  totalDiscount: number;
  tax: number;
  total: number;
  totalItems: number;
  createdAt: string;
  updatedAt: string;
  deliveryMethodId?: string;
  addressId?: string;
  paymentMethodId?: string;
  coupon?: Coupon;
}

export interface CartCategory {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  title: string;
  isActive: boolean;
  restaurant: string;
  avatarUrl: string | null;
}

export interface CartFood {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  restaurant: string;
  category: CartCategory;
  title: string;
  desc: string;
  content: string | 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[];
  inPlaceServe: boolean;
  pickupServe: boolean;
  rate: number;
  discount: number;
}

export type CartResponse = BaseResponse<CartData>;

export type SaveAllMethod = {
  description: string;
  deliveryMethodId: string;
  addressId?: string;
  paymentMethodId: string;
  tableNumber?: string;
  carAddress?: {
    carModel: string;
    carColor: string;
    plateNumber: string;
  };
  attachments?: string[];
  paymentDesc?: string;
};

export type CartStoreType = {
  description: string;
  setDescription: (value: string) => void;
  deliveryMethodId: string | null;
  setDeliveryMethodId: (value: string | null) => void;
  addressId: string | null;
  setAddressId: (value: string | null) => void;
  paymentMethodId: string | null;
  setPaymentMethodId: (value: string | null) => void;
  carAddress: {
    carModel: string;
    carColor: string;
    plateNumber: string;
  } | null;
  setCarAddress: (
    value: {
      carModel: string;
      carColor: string;
      plateNumber: string;
    } | null
  ) => void;
  reset: () => void;
  getSaveAllMethodData: () => SaveAllMethod | null;
};
