import type { IResponse } from "@/types/response.types";
import type { Restaurant } from "@/pages/paymentMethods/types/Types";

export type CouponType = "PERCENTAGE" | "FIXED";

export interface ICoupon {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  restaurant: string;
  code: string;
  name: string;
  description: string;
  type: CouponType;
  value: number;
  maxDiscount: number | null;
  minOrderAmount: number;
  maxUses: number;
  usedCount: number;
  maxUsesPerUser: number | null;
  startDate: string | null;
  endDate: string | null;
  isActive: boolean;
  [key: string]: unknown;
}

export interface ICouponDetails {
  id: string;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
  restaurant: Restaurant;
  code: string;
  name: string;
  description: string;
  type: CouponType;
  value: number;
  maxDiscount: number | null;
  minOrderAmount: number;
  maxUses: number;
  usedCount: number;
  maxUsesPerUser: number | null;
  startDate: string | null;
  endDate: string | null;
  isActive: boolean;
  foodCategories: string[];
  foods: string[];
  userPhone: string | null;
}

export type IGetCouponsResponse = IResponse<ICoupon[]>;

export type IGetCouponDetailsResponse = IResponse<ICouponDetails>;

export type CreateCouponType = {
  code: string;
  name: string;
  description: string;
  value: number;
  maxDiscount: number | null;
  minOrderAmount: number;
  maxUses: number;
  maxUsesPerUser: number | null;
  startDate: string | null;
  endDate: string | null;
  isActive: boolean;
  foodCategories?: string[];
  foods?: string[];
  userPhone?: string;
  type: CouponType;
};
