{
  "lexicon": 1,
  "id": "actor.rpg.sprite",
  "description": "A sprite sheet for an RPG character avatar.",
  "defs": {
    "main": {
      "type": "record",
      "description": "A user's RPG character sprite. Single-record user asset stored on the user's PDS.",
      "key": "literal:self",
      "record": {
        "type": "object",
        "required": ["spriteSheet", "createdAt"],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "maxGraphemes": 50,
            "description": "Display name for the character (optional, can differ from Bluesky display name)"
          },
          "spriteSheet": {
            "type": "blob",
            "accept": ["image/png"],
            "maxSize": 10000000,
            "description": "The sprite sheet image (PNG only). Max 10MB."
          },
          "rows": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16,
            "description": "Number of rows in the sprite sheet (typically 4 for directional sprites: down, left, right, up)"
          },
          "columns": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16,
            "description": "Number of columns per animation cycle"
          },
          "frames": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64,
            "description": "Total number of animation frames"
          },
          "width": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096,
            "description": "Total width of the sprite sheet in pixels"
          },
          "height": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096,
            "description": "Total height of the sprite sheet in pixels"
          },
          "frameWidth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512,
            "description": "Width of a single frame in pixels (if not auto-calculated from width/columns)"
          },
          "frameHeight": {
            "type": "integer",
            "minimum": 1,
            "maximum": 512,
            "description": "Height of a single frame in pixels (if not auto-calculated from height/rows)"
          },
          "animationSpeed": {
            "type": "integer",
            "minimum": 50,
            "maximum": 2000,
            "description": "Milliseconds per frame for animation playback. Defaults to 200 if omitted."
          },
          "source": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the generator record this sprite was composed from, if any (e.g. at://did:plc:xxx/actor.rpg.generator/self)"
          },
          "isCustom": {
            "type": "boolean",
            "description": "True when this sprite was directly uploaded or drawn by the user (not composed or recomposed by the actor.rpg.generator pipeline). When set, tools such as the theatre will not recompose this sprite from generator layers."
          },
          "origin": {
            "type": "string",
            "maxLength": 32,
            "maxGraphemes": 32,
            "description": "Optional tag indicating how this sprite was generated. Known values: 'minecraft' (converted from a Minecraft skin via the rpg.actor Minecraft Spriter)."
          },
          "spriteBackdrop": {
            "type": "string",
            "knownValues": ["default", "clear", "sunrise", "sunset", "twilight", "night", "overcast", "storm", "skybox", "void"],
            "description": "Backdrop shown behind the sprite preview. New sprites use a randomized daytime, sunrise, sunset, or twilight backdrop. Omission identifies a legacy default that is migrated when its owner opens the profile; an explicit default remains a user choice."
          },
          "minecraftName": {
            "type": "string",
            "maxLength": 64,
            "maxGraphemes": 64,
            "description": "The Minecraft username or UUID this sprite was generated from. Only set when origin is 'minecraft'."
          },
          "emotes": {
            "type": "ref",
            "ref": "#emoteSet",
            "description": "Optional expression set with direct emotion keys. Each emotion has an emote sheet and an optional talk sheet using the standard 144x192, 3x4 geometry."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "When this record was first created"
          },
          "updatedAt": {
            "type": "string",
            "format": "datetime",
            "description": "When this record was last modified"
          }
        }
      }
    },
    "emoteSet": {
      "type": "object",
      "required": ["version", "generatedAt"],
      "properties": {
        "version": {
          "type": "string",
          "maxLength": 64,
          "description": "Semantic expression version, such as rpg.actor.emote.006."
        },
        "assetVersion": {
          "type": "string",
          "maxLength": 100,
          "description": "Version of the published face artwork and expression definitions used to render these sheets."
        },
        "source": {
          "type": "string",
          "format": "at-uri",
          "description": "Generator record used to render the emote sheets."
        },
        "generatorFingerprint": {
          "type": "string",
          "maxLength": 128,
          "description": "Optional fingerprint of the generator state used to render the emote sheets."
        },
        "generatedAt": {
          "type": "string",
          "format": "datetime"
        },
        "neutral": { "type": "ref", "ref": "#emoteVariant" },
        "blink": { "type": "ref", "ref": "#emoteVariant" },
        "happy": { "type": "ref", "ref": "#emoteVariant" },
        "sad": { "type": "ref", "ref": "#emoteVariant" },
        "angry": { "type": "ref", "ref": "#emoteVariant" },
        "silly": { "type": "ref", "ref": "#emoteVariant" },
        "tired": { "type": "ref", "ref": "#emoteVariant" },
        "bruh": { "type": "ref", "ref": "#emoteVariant" },
        "pout": { "type": "ref", "ref": "#emoteVariant" }
      }
    },
    "emoteVariant": {
      "type": "object",
      "required": ["emoteSheet"],
      "properties": {
        "label": { "type": "string", "maxLength": 80 },
        "emoteSheet": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 10000000,
          "description": "Complete 144x192 PNG sprite sheet for this expression, with the same 3x4 frame contract as the primary sprite."
        },
        "talkSheet": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 10000000,
          "description": "Optional complete sheet for the same expression during speech."
        }
      }
    }
  }
}
