defmodule VendorSync.Stripe.Schemas.CheckoutSession do
  @moduledoc """
  Stripe checkout.session schema.

  Generated from Stripe OpenAPI spec on 2024-07-08
  """

  use Ecto.Schema
  use Ecto.Migration

  @primary_key {:id, :binary_id, autogenerate: false}
  schema "stripe_checkout_session" do
    field(:payment_status, :string)
    field(:ui_mode, :string)
    field(:livemode, :boolean)
    field(:saved_payment_method_options, :map)
    field(:payment_method_options, :map)
    field(:line_items, :map)
    field(:custom_fields, {:array, :map})
    field(:customer_creation, :string)
    field(:payment_link, :string)
    field(:metadata, :map)
    field(:payment_method_types, {:array, :string})
    field(:locale, :string)
    field(:return_url, :string)
    field(:shipping_address_collection, :map)
    field(:consent_collection, :map)
    field(:payment_intent, :string)
    field(:customer_email, :string)
    field(:customer_details, :map)
    field(:phone_number_collection, :map)
    field(:invoice_creation, :map)
    field(:customer, :string)
    field(:shipping_cost, :map)
    field(:submit_type, :string)
    field(:invoice, :string)
    field(:custom_text, :map)
    field(:mode, :string)
    field(:success_url, :string)
    field(:client_secret, :string)
    field(:recovered_from, :string)
    field(:object, :string)
    field(:total_details, :map)
    field(:expires_at, :integer)
    field(:automatic_tax, :map)
    field(:setup_intent, :string)
    field(:client_reference_id, :string)
    field(:after_expiration, :map)
    field(:tax_id_collection, :map)
    field(:currency, :string)
    field(:created, :integer)
    field(:currency_conversion, :map)
    field(:redirect_on_completion, :string)
    field(:amount_subtotal, :integer)
    field(:amount_total, :integer)
    field(:payment_method_collection, :string)
    field(:url, :string)
    field(:subscription, :string)
    field(:allow_promotion_codes, :boolean)
    field(:payment_method_configuration_details, :map)
    field(:billing_address_collection, :string)
    field(:cancel_url, :string)
    field(:status, :string)
    field(:shipping_details, :map)
    field(:consent, :map)
    field(:shipping_options, {:array, :map})
  end

  def up_migration do
    create table(:stripe_checkout_session, primary_key: false) do
      add(:id, :binary_id, primary_key: true)
      add(:payment_status, :string)
      add(:ui_mode, :string)
      add(:livemode, :boolean)
      add(:saved_payment_method_options, :map)
      add(:payment_method_options, :map)
      add(:line_items, :map)
      add(:custom_fields, {:array, :map})
      add(:customer_creation, :string)
      add(:payment_link, :string)
      add(:metadata, :map)
      add(:payment_method_types, {:array, :string})
      add(:locale, :string)
      add(:return_url, :string)
      add(:shipping_address_collection, :map)
      add(:consent_collection, :map)
      add(:payment_intent, :string)
      add(:customer_email, :string)
      add(:customer_details, :map)
      add(:phone_number_collection, :map)
      add(:invoice_creation, :map)
      add(:customer, :string)
      add(:shipping_cost, :map)
      add(:submit_type, :string)
      add(:invoice, :string)
      add(:custom_text, :map)
      add(:mode, :string)
      add(:success_url, :string)
      add(:client_secret, :string)
      add(:recovered_from, :string)
      add(:object, :string)
      add(:total_details, :map)
      add(:expires_at, :integer)
      add(:automatic_tax, :map)
      add(:setup_intent, :string)
      add(:client_reference_id, :string)
      add(:after_expiration, :map)
      add(:tax_id_collection, :map)
      add(:currency, :string)
      add(:created, :integer)
      add(:currency_conversion, :map)
      add(:redirect_on_completion, :string)
      add(:amount_subtotal, :integer)
      add(:amount_total, :integer)
      add(:payment_method_collection, :string)
      add(:url, :string)
      add(:subscription, :string)
      add(:allow_promotion_codes, :boolean)
      add(:payment_method_configuration_details, :map)
      add(:billing_address_collection, :string)
      add(:cancel_url, :string)
      add(:status, :string)
      add(:shipping_details, :map)
      add(:consent, :map)
      add(:shipping_options, {:array, :map})
    end
  end

  def down_migration do
    drop(table(:stripe_checkout_session))
  end

  def api_route, do: "/v1/checkout/sessions"
  def object_type, do: "checkout.session"
end