defmodule Tarakan.RepositoryCode.Commit do
  @moduledoc """
  One commit in a repository's history.

  The commits list fills only the summary fields; the commit detail view
  additionally fills `:body`, `:patch`, and `:patch_truncated`.
  """

  @enforce_keys [:sha, :author_name, :author_email, :committed_at, :subject]
  defstruct [
    :sha,
    :author_name,
    :author_email,
    :committed_at,
    :subject,
    body: nil,
    patch: nil,
    patch_truncated: false
  ]

  @type t :: %__MODULE__{
          sha: String.t(),
          author_name: String.t(),
          author_email: String.t(),
          committed_at: DateTime.t() | nil,
          subject: String.t(),
          body: String.t() | nil,
          patch: String.t() | nil,
          patch_truncated: boolean()
        }
end
