export interface PostMetadata {
  title: string;
  date: string;
  subtitle: string;
  slug: string;
  image: string;
}

// export type User = {
//   onClick: () => void;
//   text: string;
//   buttonColor: string;
//   buttonHover: string;
// }

export type TextOnUse = {
  title: string;
  subTitle: string;
  buttonText: string;
  netlifyFunction: string;
  source?: SourceModal;
};

export type LearnMoreForm = {
  email: string;
}

export type NewsLetterForm = {
  email: string;
  source: SourceModal;
}

export type SignInForm = {
  email: string;
  password?: string;
}

export type SignUpForm = {
  email: string;
  password?: string;
  passwordConfirmation: string;
  first_name: string;
  last_name: string;
  phone_number?: string;
  company_size: string;
  organisation: string;
}

export type LearnMoreValidationForm = {
  EMAIL: string;
  SOURCE: SourceModal;
}
export type SignInValidationForm = {
  EMAIL: string;
  SOURCE: SourceModal;
}
export type SignUpValidationForm = {
  EMAIL: string;
  FNAME: string; 
  LNAME: string;
  PHONE: string;
  CSIZE: string;
  SOURCE: SourceModal;
}

export type Product = {
  product_id: string;
  active: boolean;
  name: string;
  description: string;
  image: string;
  metadata: {
    benefits: string[];
  };
  product_order: number;
  yearlyPrice: Price;
  monthlyPrice: Price;
}

export type Price = {
  id: string;
  price_id: string;
  product_id: string;
  active:  boolean;
  description: string;
  unit_amount:  number;
  currency: string;
  type: string;
  interval: string;
  interval_count: number;
  trial_period_day: number;
  metadata: string;
};

export type CheckoutSession = {
  after_expiration: null | string,
  allow_promotion_codes: boolean,
  amount_subtotal: number,
  amount_total: number,
  automatic_tax: {
      enabled: boolean,
      status: string
  },
  billing_address_collection: string,
  cancel_url: string,
  client_reference_id: string,
  consent: string,
  consent_collection: string,
  created: number,
  currency: string,
  currency_conversion: null | string,
  customer: {
      address: null | string,
      balance: number,
      cash_balance: null | string,
      created: number,
      currency: string,
      default_source: null | string,
      deleted: boolean,
      delinquent: boolean,
      description: string,
      discount: null | string,
      email: string,
      id: string,
      invoice_credit_balance: null | string,
      invoice_prefix: string,
      invoice_settings: null | string,
      livemode: boolean,
      metadata: null | string,
      name: string,
      next_invoice_sequence: number,
      object: string,
      phone: string,
      preferred_locales: null | string,
      shipping: null | string,
      sources: null | string,
      subscriptions: null | string,
      tax: null | string,
      tax_exempt: string,
      tax_ids: null | string,
      test_clock: null | string
  },
  customer_creation: string,
  customer_details: {
      address: null | string,
      email: string,
      name: string,
      phone: string,
      tax_exempt: string,
      tax_ids: null | string
  },
  customer_email: string,
  custom_fields: [],
  custom_text: {
      shipping_address: null | string,
      submit: null | string
  },
  expires_at: number,
  id: string,
  invoice: null | string,
  invoice_creation: null | string,
  line_items: null | string,
  livemode: boolean,
  locale: string,
  metadata: {},
  mode: string,
  object: string,
  payment_intent: null | string,
  payment_link: null | string,
  payment_method_collection: string,
  payment_method_configuration_details: null | string,
  payment_method_options: null | string,
  payment_method_types: string[],
  payment_status: string,
  phone_number_collection: {
      enabled: boolean
  },
  recovered_from: string,
  setup_intent: null | string,
  shipping_address_collection: null | string,
  shipping_cost: null | string,
  shipping_details: null | string,
  shipping_options: [],
  status: string,
  submit_type: string,
  subscription: null | string,
  success_url: string,
  tax_id_collection: null | string,
  total_details: {
      amount_discount: number,
      amount_shipping: number,
      amount_tax: number,
      breakdown: null | string
  },
  url: string
}

export enum ModalStatus {
  Success = 'success',
  Loading = 'loading',
  Default = 'default',
}

export enum SourceModal {
  SignUp = 'SignUp',
  SignUpViaPurchase = 'SignUpViaPurchase',
  BookDemo = 'BookDemo',
  LearnMore = 'LearnMore',
  TryIt = 'TryIt',
  Newsletter = 'Newsletter',
}

export type MailchimpSearchMemberResponse = {
  exact_matches: { 
    members: MailchimpMember[];
    total_items: number;
  },
  full_search: { 
    members: any[];
    total_items: number;
  },
  _links: [
    {
      rel: string;
      href: string;
      method: string;
      targetSchema: string;
    }
  ]
}

export type MailchimpMember = {
  id: string,
  email_address: string,
  unique_email_id: string,
  contact_id: string,
  full_name: string,
  web_id: number,
  email_type: string,
  status: string,
}

export type User = {
  avatar: string;
  billing_address: string;
  collectionId: string;
  collectionName: string;
  created: string | Date;
  displayName: string;
  email: string;
  emailVisibility: string;
  firstName: string;
  id: string
  lastName: string | Date;
  lastSeen: string;
  organisation: string;
  payment_method: string;
  role: string;
  updated: string | Date;
  username: string;
  verified: boolean;
}

export type Subscription = {
  subscription_id: string,
  user_id: string,
  status: string,
  price_id: string,
  metadata: string,
  quantity: number,
  cancel_at_period_end: boolean,
  current_period_start: string | Date,
  current_period_end: string | Date,
  ended_at: string | Date,
  cancel_at: string | Date,
  canceled_at: string | Date,
  trial_start: string | Date,
  trial_end:string | Date,
  product: Product
};

export type SubscriptionSession = {
  configuration: {
      active: boolean,
      application: null | string,
      business_profile: null | string,
      created: number,
      default_return_url: string,
      features: null | string,
      id: string,
      is_default: boolean,
      livemode: boolean,
      login_page: null | string,
      metadata: null | string,
      object: string,
      updated: number
  },
  created: number,
  customer: string,
  flow: null | string,
  id: string,
  livemode: boolean,
  locale: string,
  object: string,
  on_behalf_of: string,
  return_url: string,
  url: string
}