# `PhoenixKitComments.Comment`
[🔗](https://github.com/BeamLabEU/phoenix_kit_comments/blob/v0.1.3/lib/phoenix_kit_comments/schemas/comment.ex#L1)

Schema for polymorphic comments with unlimited threading depth.

Supports nested comment threads (Reddit-style) with self-referencing parent/child
relationships. Can be attached to any resource type via `resource_type` + `resource_uuid`.

## Comment Status

- `published` - Comment is visible
- `hidden` - Comment is hidden by moderator
- `deleted` - Comment deleted (soft delete)
- `pending` - Awaiting moderation approval

## Fields

- `resource_type` - Type of resource (e.g., "post", "entity", "ticket")
- `resource_uuid` - UUID of the resource
- `user_uuid` - Reference to the commenter
- `parent_uuid` - Reference to parent comment (nil for top-level)
- `content` - Comment text
- `status` - published/hidden/deleted/pending
- `depth` - Nesting level (0=top, 1=reply, 2=reply-to-reply, etc.)
- `like_count` - Denormalized like counter
- `dislike_count` - Denormalized dislike counter
- `metadata` - Arbitrary JSONB data (giphy reactions, custom flags, rich embeds, etc.)

# `t`

```elixir
@type t() :: %PhoenixKitComments.Comment{
  __meta__: term(),
  children: [t()] | Ecto.Association.NotLoaded.t(),
  content: String.t(),
  depth: integer(),
  dislike_count: integer(),
  inserted_at: DateTime.t() | nil,
  like_count: integer(),
  metadata: map(),
  parent: t() | Ecto.Association.NotLoaded.t() | nil,
  parent_uuid: UUIDv7.t() | nil,
  resource_type: String.t(),
  resource_uuid: Ecto.UUID.t(),
  status: String.t(),
  updated_at: DateTime.t() | nil,
  user: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t() | nil,
  user_uuid: UUIDv7.t() | nil,
  uuid: UUIDv7.t() | nil
}
```

# `changeset`

Changeset for creating or updating a comment.

## Required Fields

- `resource_type` - Type of resource being commented on
- `resource_uuid` - UUID of the resource
- `user_uuid` - Reference to commenter
- `content` - Comment text

# `deleted?`

Check if comment is deleted.

# `published?`

Check if comment is published.

# `reply?`

Check if comment is a reply (has parent).

# `top_level?`

Check if comment is top-level (no parent).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
