import { Store } from "./order";
import { Commission } from "./payments";

export interface IShoppingCart {
  userBID: string;
  reference: string;
  shippingCartProducts: any[];
  billingAddressId: number | null;
  shippingAddressId: number | null;
  storeId: number | null;
  paymentMethodId: number | null;
  id: number;
  cartState: string;
  subTotal: string;
  feesTotal: string;
  taxTotal: string;
  grandTotal: string;
  isActive: boolean;
  createdAt: string;
  updatedAt: string;
  fees: Fee[];
  taxes: Tax[];
  cartAsset: CartAsset;
  store?: Store;
  cashBacks?: null | CashBack[];
  isSmartPay?: boolean;

  commissionSubTotal: string;
  oneCareTotal: string;
  orderId: string;
  pickupCostTotal: string;
  shippingCartAssetId: string;
  shippingMethodId: number;
  shippingMethod: ShippingMethod;
  shippingCostTotal: string;
  upgradeCostTotal: string;
  userSubscriptionType: string;
  shippingAddress: UserAddress;
  billingAddress: UserAddress;
  paymentMethod: {
    code: string;
    id: number;
    name: string;
  };

  shippingCartAsset: CartAsset;
}

type ShippingMethod = {
  code: string;
  description: string;
  displayName: string;
};
type CartAsset = {
  id: number;
  cartId: number;
  assetOption: {
    id: number;
    name: string;
    symbol: string;
    isActive: boolean;
    optionId: number;
    provider: string;
    createdAt: string;
    deletedAt: string;
    isDeleted: boolean;
    updatedAt: string;
    isVariable: boolean;
    optionName: string;
    displayOrder: number;
    optionSymbol: string;
    isAssetActive: boolean;
    minPercentage: number;
    optionIsActive: boolean;
    paymentMethodId: number;
    isCommissionEnabled: boolean;
    commissionMultiplier: {
      base: {
        cv: number;
        vp: number;
      };
      option: {
        cv: number;
        vp: number;
      };
    };
  };
  calculatedCommision: Commission;
  baseAssetName: string;
  baseAssetSymbol: string;
  baseAssetAmount: number;
  baseAssetPercentage: number;
  optionAssetName: string;
  optionAssetSymbol: string;
  optionAssetAmount: number;
  optionAssetPercentage: string;
  createdAt: string;
  updatedAt: string;
};
type Fee = {
  amount: string;
  cartId: number;
  feeCategory: string;
  feeName: string;
  id: number;
  type: string;
  value: string;
};
type Tax = {
  amount: string;
  cartId: number;
  id: number;
  taxCategory: string;
  taxName: string;
  type: string;
  value: string;
};

export type CashBack = {
  id: number;
  shippingCartId: number;
  assetName: string;
  assetSymbol: string;
  cashbackAssetId: number;
  totalAmount: string;
};

export type cartProduct = {
  id: number;
  sku: string;
  name: string;
  featureImage: string;
  category: cartProductCategory;
  price: number;
  canProductBeRemoved: boolean;
  canUserPurchaseTheProduct: boolean;
  feedBackMessage: string;
  maximumUserCanPurchase: number | null;
  totalOrderExistsForProduct: number | null;
  userPurchaseLimit: number | null;
  notAllowedShippingMethods?: string[];
};

export type cartProductCategory = {
  id: number;
  code: string;
  name: string;
};

export type CartTableItemComponentProps = {
  id: number;
  product: cartProduct;
  quantity: number;
  cartProducts: number;
  userPurchaseLimit: number | null;
  maximumUserCanPurchase: number | null;
  totalOrderExistsForProduct: number | null;
  feedBackMessage: string;
  canUserPurchaseTheProduct: boolean;
  canProductBeRemoved: boolean;
};

export type BillingAddress = {
  address: string;
  buildingInfo: string;
  city: string;
  country: string;
  countryId: number;
  createdAt: string;
  deletedAt: string;
  id: number;
  isActive: boolean;
  isDefault: boolean;
  isDeleted: boolean;
  latitude: string;
  longitude: string;
  state: string;
  type: string;
  updatedAt: string;
  userId: number;
};
export type UserAddress = {
  id: number;
  userBID: string;
  firstName: string;
  lastName: string;
  phone: string;
  email: string;
  countryId: 3;
  countryCode: string;
  city: string;
  state: string;
  postalCode: string;
  address: string;
  buildingInfo: string;
  latitude: string;
  longitude: string;
  type: string;
  isDefault: boolean;
  isActive: boolean;
  isDeleted: boolean;
  createdAt: string;
  updatedAt: string;
  deletedAt: string;
  country: {
    id: 3;
    name: string;
    code: string;
    alphaCode: string;
    callingCode: string;
    zipCodeExists: boolean;
    zipCodeRegex: string;
    isActive: boolean;
    isDeleted: boolean;
    createdAt: string;
    updatedAt: string;
    deletedAt: string;
  };
};
