{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myarchivist-ai/json-schema/myarchivist-ai-user-profile-schema.json",
  "title": "UserProfile",
  "description": "Extended user profile for authenticated users",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myarchivist-ai-openapi.json#/components/schemas/UserProfile",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "name": {
      "type": "string",
      "title": "Name"
    },
    "given_name": {
      "type": "string",
      "title": "Given Name"
    },
    "family_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Family Name"
    },
    "picture": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Picture"
    },
    "role": {
      "$ref": "#/$defs/UserRole"
    },
    "verified": {
      "type": "boolean",
      "title": "Verified"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "email": {
      "type": "string",
      "title": "Email"
    },
    "subscription_tier": {
      "anyOf": [
        {
          "$ref": "#/$defs/SubscriptionTier"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "anyOf": [
        {
          "$ref": "#/$defs/SubscriptionStatus"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_login": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Login"
    },
    "new_user": {
      "type": "boolean",
      "title": "New User"
    },
    "campaign_slots_remaining": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Campaign Slots Remaining"
    },
    "any_sessions_remaining": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Any Sessions Remaining"
    },
    "text_sessions_remaining": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Text Sessions Remaining"
    },
    "billing_cycle_start": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Billing Cycle Start"
    },
    "billing_cycle_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Billing Cycle End"
    },
    "scopes": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Scopes"
    },
    "api_profile": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Api Profile"
    },
    "launch_promo": {
      "anyOf": [
        {
          "$ref": "#/$defs/LaunchPromoState"
        },
        {
          "type": "null"
        }
      ]
    },
    "access": {
      "anyOf": [
        {
          "$ref": "#/$defs/AccountAccess"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "id",
    "name",
    "given_name",
    "role",
    "verified",
    "created_at",
    "email",
    "new_user"
  ],
  "$defs": {
    "AccountAccess": {
      "properties": {
        "level": {
          "type": "string",
          "title": "Level"
        },
        "subscription_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Subscription Status"
        },
        "can_create_campaign": {
          "type": "boolean",
          "title": "Can Create Campaign",
          "default": true
        },
        "blocked": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Blocked"
        }
      },
      "type": "object",
      "required": [
        "level"
      ],
      "title": "AccountAccess",
      "description": "What this account's plan currently allows. Reading existing content is always allowed."
    },
    "LaunchPromoState": {
      "properties": {
        "active": {
          "type": "boolean",
          "title": "Active"
        },
        "ends_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ends At"
        }
      },
      "type": "object",
      "required": [
        "active"
      ],
      "title": "LaunchPromoState"
    },
    "SubscriptionStatus": {
      "type": "string",
      "enum": [
        "incomplete",
        "active",
        "past_due",
        "canceled",
        "incomplete_expired",
        "trialing",
        "unpaid",
        "paused"
      ],
      "title": "SubscriptionStatus"
    },
    "SubscriptionTier": {
      "type": "string",
      "enum": [
        "casual",
        "seasoned",
        "pro",
        "legend",
        "godmode",
        "trial"
      ],
      "title": "SubscriptionTier"
    },
    "UserRole": {
      "type": "string",
      "enum": [
        "user",
        "player",
        "admin"
      ],
      "title": "UserRole"
    }
  }
}