defmodule Berrypod.Analytics.Event do
  @moduledoc """
  Schema for analytics events (pageviews, e-commerce events, etc.).

  Events are immutable — inserted once, never updated.
  """

  use Ecto.Schema

  @primary_key {:id, :binary_id, autogenerate: true}

  schema "analytics_events" do
    field :name, :string
    field :pathname, :string
    field :visitor_hash, :binary
    field :session_hash, :binary
    field :referrer, :string
    field :referrer_source, :string
    field :utm_source, :string
    field :utm_medium, :string
    field :utm_campaign, :string
    field :country_code, :string
    field :screen_size, :string
    field :browser, :string
    field :os, :string
    field :revenue, :integer

    timestamps(type: :utc_datetime, updated_at: false)
  end
end
