{
  "lexicon": 1,
  "id": "me.gdey.resolutionroulette.entry",
  "defs": {
    "main": {
      "type": "record",
      "description": "A user's set of resolutions for a countdown period ending on the resolution date. One record per countdown; rkey is a TID assigned at creation.",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["resolutionDate", "startDate", "resolutions", "createdAt"],
        "properties": {
          "title": {
            "type": "string",
            "description": "A short, user-supplied label for this entry. Displayed on the dashboard to distinguish multiple concurrent games. Optional; clients fall back to a label derived from the goal date when absent.",
            "maxGraphemes": 128,
            "maxLength": 1280
          },
          "announcePrefix": {
            "type": "string",
            "description": "Text prepended before the winner's name in the announcement post (e.g. '🎉' or 'The next book to read is:'). Optional; defaults to '🎉' when absent. Counts toward the 300-grapheme post budget.",
            "maxGraphemes": 100,
            "maxLength": 1000
          },
          "resolutionDate": {
            "type": "string",
            "format": "datetime",
            "description": "The datetime at which a surviving resolution is randomly promoted and posted. Stored in UTC; the time component encodes the user-chosen reveal hour (defaults to midnight UTC)."
          },
          "startDate": {
            "type": "string",
            "format": "datetime",
            "description": "The date on which daily eliminations begin. Stored as midnight UTC."
          },
          "resolutions": {
            "type": "array",
            "description": "Ordered list of resolutions submitted by the user. Submission order is preserved and used for display.",
            "minLength": 1,
            "items": {
              "type": "ref",
              "ref": "#resolution"
            }
          },
          "tagUsers": {
            "type": "array",
            "description": "Users to @mention when the promoted resolution is posted. Mentions are appended in submission order and dropped if they do not fit within the grapheme budget.",
            "items": {
              "type": "ref",
              "ref": "#tagUser"
            }
          },
          "tags": {
            "type": "array",
            "description": "Hashtags to include in the promotion post, without the # prefix. Appended in order and dropped if they do not fit within the grapheme budget.",
            "items": {
              "type": "string",
              "maxGraphemes": 64,
              "maxLength": 640
            }
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Timestamp when this entry record was created."
          }
        }
      }
    },
    "resolution": {
      "type": "object",
      "description": "A single resolution within an entry.",
      "required": ["id", "text"],
      "properties": {
        "id": {
          "type": "integer",
          "description": "Stable identifier for this resolution within the entry. A sequential integer assigned at submission (0-based). Must be unique across all resolutions in this entry — uniqueness is not enforced by the lexicon and must be validated by the submission handler. Referenced by elimination and promotion records. Safe to reassign on edit before startDate, since no elimination or promotion records exist yet at that point."
        },
        "text": {
          "type": "string",
          "description": "The resolution text. May be truncated in the promotion post if it exceeds the grapheme budget after fixed overhead.",
          "maxGraphemes": 1000,
          "maxLength": 10000
        },
        "eliminatedOn": {
          "type": "string",
          "format": "datetime",
          "description": "The date this resolution was eliminated, stored as midnight UTC. Absent if the resolution is still surviving."
        }
      }
    },
    "tagUser": {
      "type": "object",
      "description": "A user to @mention in the promotion post.",
      "required": ["did", "handle"],
      "properties": {
        "did": {
          "type": "string",
          "format": "did",
          "description": "The user's DID. Used to construct the mention facet."
        },
        "handle": {
          "type": "string",
          "format": "handle",
          "description": "The user's handle at the time the entry was created. Used as the display text for the mention."
        }
      }
    }
  }
}
