{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/sewerai/main/json-schema/sewerai-user-schema.json",
  "title": "User",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sewerai-accounts-api-openapi.yml#/components/schemas/User",
  "required": [
    "username",
    "email",
    "admin",
    "staff",
    "labeler",
    "is_senior_labeler",
    "picture",
    "certificates",
    "joined",
    "email_verified",
    "phone_number",
    "organization",
    "country_code",
    "country_area_code",
    "country_area",
    "city",
    "postal_code"
  ],
  "type": "object",
  "properties": {
    "sid": {
      "title": "Sid",
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "username": {
      "title": "Username",
      "description": "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
      "type": "string",
      "pattern": "^[\\w.@+-]+$",
      "maxLength": 150,
      "minLength": 1
    },
    "first_name": {
      "title": "First name",
      "type": "string",
      "maxLength": 150
    },
    "last_name": {
      "title": "Last name",
      "type": "string",
      "maxLength": 150
    },
    "email": {
      "title": "Email",
      "type": "string",
      "format": "email",
      "maxLength": 254,
      "minLength": 1
    },
    "admin": {
      "title": "Admin",
      "type": "boolean"
    },
    "staff": {
      "title": "Staff",
      "type": "boolean"
    },
    "labeler": {
      "title": "Labeler",
      "type": "boolean"
    },
    "is_senior_labeler": {
      "title": "Is senior labeler",
      "type": "boolean"
    },
    "tos_accepted": {
      "title": "Tos accepted",
      "type": "string",
      "readOnly": true
    },
    "picture": {
      "title": "Picture",
      "type": "string"
    },
    "certificates": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Certificate"
      }
    },
    "account_level": {
      "title": "Account level",
      "type": "string",
      "readOnly": true
    },
    "joined": {
      "title": "Joined",
      "type": "string",
      "minLength": 1
    },
    "email_verified": {
      "title": "Email verified",
      "type": "boolean"
    },
    "phone_number": {
      "title": "Phone number",
      "type": "string"
    },
    "organization": {
      "title": "Organization",
      "type": "string"
    },
    "country_code": {
      "title": "Country code",
      "type": "string"
    },
    "country_area_code": {
      "title": "Country area code",
      "type": "string"
    },
    "country_area": {
      "title": "Country area",
      "type": "string"
    },
    "city": {
      "title": "City",
      "type": "string"
    },
    "postal_code": {
      "title": "Postal code",
      "type": "string"
    },
    "token": {
      "title": "Token",
      "type": "string",
      "readOnly": true
    },
    "auth_type": {
      "title": "Auth type",
      "type": "string",
      "readOnly": true
    },
    "auth_token": {
      "title": "Auth token",
      "type": "string",
      "readOnly": true
    },
    "source": {
      "title": "Source",
      "type": "string",
      "readOnly": true
    },
    "meta": {
      "title": "Meta",
      "type": "object"
    }
  },
  "$defs": {
    "Certificate": {
      "type": "object",
      "properties": {
        "number": {
          "title": "Certificate Number",
          "description": "The Certificate Number",
          "type": [
            "string",
            "null"
          ],
          "maxLength": 64
        },
        "cert_date": {
          "title": "Cert date",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}