
interface UserType {
  id: number,
  uuid: string,
  email: string;
  profile?: ProfileType
}


type CollectionType = {
  uuid: any;
  collection_images: SetStateAction<Object[]>;
  id: string;
  title: string;
  description: string;
  collection_images: string[];
  // products: string[];
};

type Address = {
  id: number;
  uuid: string,
  name: string;
  address_line: string;
  post_code: string;
  city: string;
  district: string;
  division: string;
  phone: string;
  is_default: boolean;
  shipping_zone: string;
};



type UserRole = "ADMIN" | "USER";

type RecentSalesData = {
  id: string;
  product: string;
  amount: number;
  quantity: number;
  status: "PLACED"
  | "PROCESSING"
  | "DISPATCHED"
  | "DELIVERED"
  | "CANCELED";
};

type CategoryType = {
  id: string;
  uuid: string
  name: string;
  description?: string;
  category_type: ""
  parent_id: string;
  children: CategoryType[];
  filters?: string | JSON;
  // products: int;
};

type DeliveryCostType = {
  id: number,
  uuid: string,
  city: string,
  district: string,
  division: string,
  post_code: string,
  shipping_zone: string,
  courier_company_name?: string,
  delivery_cost: number,
  per_kg_cost?: number,

}


interface SelectColorSizeQuantity {
  color: string,
  size: string,
  quantity: number
}


interface SelectCategoryType {
  id: string,
  name: string,
}
interface ProductImages {
  id: string;
  uuid: string;
  file_name: string;
  file_url: string;
}

interface SelectVariants {
  color: string,
  size: string,
  quantity: number,
  regular_price: number,
  purchase_cost: number,
  special_price: number,
}

type ProductCollectionType = {
  id: string;
  uuid: string;
  title: string;
  description: string;
}

type ProductType = {
  productCollection: any;
  id: string;
  uuid: string;
  product_name: string;
  description: string;
  collection: ProductCollectionType;
  category: SelectCategoryType;
  sub_category: SelectCategoryType;
  sub_sub_category: SelectCategoryType;
  tags: [string];
  variants: SelectVariants[],
  brand: string;

};

type ProductVariant = {
  id: string;
  name: string,
  uuid: string;
  product_id: string;
  on_sell: boolean;
  quantity: number;
  regular_price: number;
  purchase_cost: number;
  special_price: number;
  wareHouseInfo: string;
  sku: string;
  specs: string;
  variant_images: attachments[] // Update it later
  product: ProductType
  averageRating?: number
  _count?: { Review: number }
}


interface attachments {
  id: string,
  uuid: string,
  file_url: string,
  file_id: string,
  variant_id: string,
  file_name: string,
  file_size: string,
  file_type: string,
  original_name: string,
  created_at: string,
  updated_at: string,
}

type OrderItemsType = {
  id: string,
  uuid: string;
  variant: ProductVariant
  quantity: number;
  price: number;
  created_on: string;
  updated_on: string;
  updated_by?: string;
}

type OrdersType = {
  id: string,
  uuid: string;
  order_date: Date,
  order_total_amount: number,
  order_status: string,
  delivery_cost?: number,
  address: Address
  payment: Payments,
  shipment_details: ShippingsInfo,
  order_items: OrderItemsType[],
  created_on: string
  updated_on: string
  updated_by?: string
  applied_discount?: number
  applied_coupon?: CouponsType


}


type ShippingsInfo = {
  id: string;
  uuid: string;

  name: string
  email: string
  phone: string
  receiver_name: string
  description?: string
  shipping_receipt?: attachments

  delivery_cost: DeliveryCostType

  shipping_status: string
  dispatch_date?: string
  delivery_date?: string
  courier_company?: string
  tracking_slip_number?: string
  dispatched_by?: string
  delivered_by?: string
  is_delivered: boolean
};

interface Coupon {
  id: number;
  code: string;
  type: DiscountType;
  value: number;

  maxDiscount?: number | null;
  minPurchaseAmount?: number | null;
  startDate?: Date | null;
  endDate?: Date | null;
  usageLimit?: number | null;
  usageCount: number;
  perUserLimit?: number | null;
  isActive: boolean;

  createdAt: Date;
  updatedAt: Date;

  products: Product[];
  categories: Categories[];
  collections: Collections[];
  variants: ProductVariant[];

  CouponUsage: CouponUsage[];

  Orders: Orders[];
}

type Payments = {
  id: number;
  uuid: string;
  payment_status: "PENDING" | "PAID" | "FAILED" | "REFUNDED";
  amount: number;
  payment_date: Date;
  created_on: Date,
  paymentID
  payment_method: "CASH_ON_DELIVERY" | "NAGAD" | "BKASH";
  order_id: number;
  transactionStatus: string,
  order: OrdersType,
  profile_id: number;
  profile: ProfileType
};



interface CouponUsage {
  id: number;
  couponId: number;
  userId: number;
  usedAt: DateTime;
  coupon: Coupon;
  users: User[];
}

interface CouponsType {
  id: number;
  code: string;
  type: DiscountType;
  value: number;

  maxDiscount?: number;
  minPurchaseAmount?: number;
  startDate?: DateTime;
  endDate?: DateTime;
  usageLimit?: number;
  usageCount: number;
  perUserLimit?: number;
  isActive: boolean;

  createdAt: DateTime;
  updatedAt: DateTime;

  // Relations here //
  products: Product[];
  categories: Categories[];
  collections: Collections[];
  variants: ProductVariant[];

  couponUsage: CouponUsage[];
}


type ProfileType = {
  id: number,
  uuid: string,
  full_name: string,
  gender: string,
  mobile_number: string,
  updated_by?: string,
  updated_on: string,
  user_id: number,
  user: UserType,
  profile_picture?: attachments,
}

type WishlistType = {
  id: number,
  uuid: string,
  profile_id: number,
  profile: null, // Fix it with ProfileType

  WishListItem: WishlistItem[]
  created_on: string,
  updated_on: string,
  updated_by?: string
}

type WishlistItem = {
  id: number,
  uuid: string,
  wishlist_id: number,

  variant_id: number,
  variant: ProductVariant,

  created_at: string,
  updated_at: string
}

type QuestionType = {
  id: number,
  uuid: string,
  question: string,
  answer?: string,
  profile_id: number,
  profile: ProfileType,
  variant_id?: number,
  variant?: ProductVariant,
  created_on: string,
  updated_on: string,
  updated_by?: string
}

type ReviewType = {
  id: number,
  uuid: string,
  review: string,
  rating: number,
  profile_id: number,
  profile: ProfileType,

  variant_id?: number,
  variant?: ProductVariant,
  created_on: string,
  updated_on: string,
  updated_by?: string
}


type sliderType = {
  id: number,
  uuid: string,

  title: string,
  description: string,

  is_active: boolean,

  attachments: attachments[],

  created_on: string,
  created_by?: string,
  updated_on: string,
  updated_by?: string

}

type footerSectionType = {
  id: number,
  uuid: string,
  title: string,
  description: string,

  created_on: string,
  created_by?: string,
  updated_on: string,
  updated_by?: string

}