{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Creates a role in a community.",
      "errors": [
        {
          "description": "The request is missing, malformed, or unverifiable service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller lacks the role.manage permission.",
          "name": "Forbidden"
        },
        {
          "description": "No community exists at the given DID.",
          "name": "CommunityNotFound"
        },
        {
          "description": "The arguments are inconsistent or malformed beyond schema validation.",
          "name": "InvalidRequest"
        },
        {
          "description": "The requested position is at or above the caller's highest role position, or the permissions include one the caller does not hold.",
          "name": "RoleHierarchy"
        },
        {
          "description": "The AppView cannot act as the community because its stored credentials are missing or unusable.",
          "name": "CredentialsUnavailable"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "badge": {
              "description": "An icon badge. Image badges are set with social.colibri.beta.role.putBadgeImage.",
              "ref": "social.colibri.beta.community.defs#roleIconBadge",
              "type": "ref"
            },
            "color": {
              "description": "Hex colour as #rrggbb.",
              "maxLength": 7,
              "type": "string"
            },
            "community": {
              "description": "The community to create the role in.",
              "format": "did",
              "type": "string"
            },
            "emojiBadge": {
              "description": "An emoji badge. Cannot be combined with badge.",
              "ref": "social.colibri.beta.community.defs#roleEmojiBadge",
              "type": "ref"
            },
            "hoisted": {
              "description": "Whether holders are listed separately in the member list.",
              "type": "boolean"
            },
            "mentionable": {
              "description": "Whether @role mentions resolve to this role.",
              "type": "boolean"
            },
            "name": {
              "description": "Display name.",
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            },
            "permissions": {
              "description": "Permissions granted by this role.",
              "items": {
                "description": "A namespaced permission identifier.",
                "type": "string"
              },
              "type": "array"
            },
            "position": {
              "description": "Hierarchy position. Higher outranks lower.",
              "type": "integer"
            }
          },
          "required": [
            "community",
            "name",
            "permissions"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "role": {
              "description": "The newly created role.",
              "ref": "social.colibri.beta.community.defs#roleView",
              "type": "ref"
            }
          },
          "required": [
            "role"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.colibri.beta.role.create",
  "lexicon": 1
}
