import { z } from "zod";

export interface FormField<T> {
  name: string;
  value: T;
  label?: string | null;
  placeholder?: string | null;
  inputClassName?: string;
  onValid: (value: string) => void;
  onInvalid: () => void;
}

export enum Currency {
  USD = "USD",
  EUR = "EUR",
  usd = "usd",
  eur = "eur",
}

export enum ERetainingFunnel {
  Red = "red",
  Green = "green",
  Purple = "purple",
  Stay50 = "stay50",
}

declare global {
  interface Window {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    ym: any;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    ymab: any;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    klaviyo: any;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    fbq: any;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    CollectJS: any;

    __YM_COUNTER_ID__: number;
  }
}

/* ---------- ActionField ---------- */
export const ActionFieldSchema = z.object({
  _id: z.string(),
  actionId: z.string(),
  key: z.string(),
  title: z.string(),
  inputType: z.string(),
  model: z.string().optional(),
  property: z.string().optional(),
  createdAt: z.string(),
  updatedAt: z.string(),
  value: z.union([z.string(), z.number(), z.null()]).optional(),
});
export type ActionField = z.infer<typeof ActionFieldSchema>;

export type ActionResponse<T> = {
  data: T | null;
  error: string | null;
};

export enum ELocalesPlacement {
  V0 = "v0", // Main site version
  V1 = "v1",
  PalmistryV0 = "palmistry-v0",
  PalmistryV01 = "palmistry-v0_1",
  PalmistryV1 = "palmistry-v1",
  PalmistryV11 = "palmistry-v1_1",
  Chats = "chats",
  EmailMarketingCompatibilityV1 = "email-marketing-comp-v1",
  EmailMarketingPalmistryV2 = "email-marketing-palmistry-v2",
  EmailMarketingCompatibilityV2 = "email-marketing-comp-v2",
  EmailMarketingSoulmateV1 = "email-marketing-soulmate-v1",
  EmailMarketingCompatibilityV3 = "email-marketing-comp-v3",
  EmailMarketingCompatibilityV4 = "email-marketing-comp-v4",
  CompatibilityV2 = "compatibility-v2",
  CompatibilityV3 = "compatibility-v3",
  CompatibilityV4 = "compatibility-v4",
  EmailGenerator = "email-generator",
  Profile = "profile",
  RetainingFunnel = "retaining-funnel",
}
