{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-organization-response-schema.json",
  "title": "OrganizationResponse",
  "description": "Organization visible to an authenticated account.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-organizations-api-openapi.yml#/components/schemas/OrganizationResponse",
  "properties": {
    "access_state": {
      "$ref": "#/$defs/OrganizationAccessState",
      "description": "Effective organization access state."
    },
    "created_at": {
      "description": "Organization creation timestamp.",
      "format": "date-time",
      "type": "string"
    },
    "id": {
      "description": "Organization identifier.",
      "format": "uuid",
      "type": "string"
    },
    "name": {
      "description": "Display name.",
      "type": "string"
    },
    "next": {
      "description": "Display-safe next action for this organization.",
      "type": "string"
    },
    "next_action": {
      "$ref": "#/$defs/OrganizationNextActionResponse",
      "description": "Stable machine-readable action for clients that should not parse `next`."
    },
    "role": {
      "$ref": "#/$defs/OrganizationRole",
      "description": "Authenticated account role in this organization."
    },
    "slug": {
      "description": "Stable URL/API slug when assigned.",
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "slug",
    "access_state",
    "role",
    "created_at",
    "next",
    "next_action"
  ],
  "type": "object",
  "$defs": {
    "OrganizationAccessState": {
      "description": "Effective organization access state.",
      "oneOf": [
        {
          "const": "active",
          "description": "Organization can be used.",
          "type": "string"
        },
        {
          "const": "paused",
          "description": "Organization is retained but paused until subscription resumes.",
          "type": "string"
        }
      ]
    },
    "OrganizationNextActionCode": {
      "description": "Stable organization readiness action code.",
      "oneOf": [
        {
          "const": "choose_plan",
          "description": "Choose a paid plan before organization creation.",
          "type": "string"
        },
        {
          "const": "create_organization",
          "description": "Create the first organization.",
          "type": "string"
        },
        {
          "const": "manage_members",
          "description": "Manage organization members and roles.",
          "type": "string"
        },
        {
          "const": "invite_teammates",
          "description": "Invite teammates to the organization.",
          "type": "string"
        },
        {
          "const": "review_access",
          "description": "Review current organization access.",
          "type": "string"
        },
        {
          "const": "resume_subscription",
          "description": "Resume an inactive paid subscription.",
          "type": "string"
        },
        {
          "const": "manage_organization_limit",
          "description": "Manage organization limits before creating another organization.",
          "type": "string"
        },
        {
          "const": "review_invitations",
          "description": "Review pending organization invitations.",
          "type": "string"
        }
      ]
    },
    "OrganizationNextActionResponse": {
      "description": "Stable machine-readable organization readiness action.",
      "properties": {
        "code": {
          "$ref": "#/$defs/OrganizationNextActionCode",
          "description": "Stable action code."
        },
        "target": {
          "$ref": "#/$defs/OrganizationNextActionTarget",
          "description": "Stable product surface the client should route to."
        }
      },
      "required": [
        "code",
        "target"
      ],
      "type": "object"
    },
    "OrganizationNextActionTarget": {
      "description": "Stable organization readiness action target.",
      "oneOf": [
        {
          "const": "pricing",
          "description": "Pricing or plan-selection surface.",
          "type": "string"
        },
        {
          "const": "billing",
          "description": "Billing or subscription-management surface.",
          "type": "string"
        },
        {
          "const": "organization",
          "description": "Organization settings or creation surface.",
          "type": "string"
        },
        {
          "const": "members",
          "description": "Organization member management surface.",
          "type": "string"
        },
        {
          "const": "invitations",
          "description": "Organization invitation management surface.",
          "type": "string"
        }
      ]
    },
    "OrganizationRole": {
      "description": "Organization membership role.",
      "oneOf": [
        {
          "const": "owner",
          "description": "Organization owner with billing and destructive permissions.",
          "type": "string"
        },
        {
          "const": "admin",
          "description": "Organization admin for membership operations, without implicit project visibility.",
          "type": "string"
        },
        {
          "const": "member",
          "description": "Organization member whose project visibility comes only from explicit assignments.",
          "type": "string"
        }
      ]
    }
  }
}