{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-organization-list-response-schema.json",
  "title": "OrganizationListResponse",
  "description": "Organization list response for 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/OrganizationListResponse",
  "properties": {
    "next": {
      "description": "Display-safe next action for organization readiness.",
      "type": "string"
    },
    "next_action": {
      "$ref": "#/$defs/OrganizationNextActionResponse",
      "description": "Stable machine-readable action for clients that should not parse `next`."
    },
    "organizations": {
      "description": "Organizations visible to the account.",
      "items": {
        "$ref": "#/$defs/OrganizationResponse"
      },
      "type": "array"
    },
    "subscription": {
      "$ref": "#/$defs/AccountSubscriptionResponse",
      "description": "Backend-owned subscription readiness for organization actions."
    }
  },
  "required": [
    "organizations",
    "subscription",
    "next",
    "next_action"
  ],
  "type": "object",
  "$defs": {
    "AccountBillingInterval": {
      "description": "Billing interval for a subscription tier.",
      "oneOf": [
        {
          "const": "none",
          "description": "No billing interval applies.",
          "type": "string"
        },
        {
          "const": "monthly",
          "description": "Monthly billing.",
          "type": "string"
        },
        {
          "const": "yearly",
          "description": "Yearly billing.",
          "type": "string"
        }
      ]
    },
    "AccountSubscriptionAccessState": {
      "description": "Effective account access state for paid-gated surfaces.",
      "oneOf": [
        {
          "const": "active",
          "description": "Account access is active.",
          "type": "string"
        },
        {
          "const": "paused",
          "description": "Paid-gated account access is paused.",
          "type": "string"
        }
      ]
    },
    "AccountSubscriptionBlocker": {
      "description": "Stable organization creation blocker.",
      "oneOf": [
        {
          "const": "subscription_required",
          "description": "A paid subscription is required. Released clients still parse it; no plan blocks\norganization creation, so the API never returns it.",
          "type": "string"
        },
        {
          "const": "subscription_inactive",
          "description": "The subscription exists but is not active. Released clients still parse it; the API\nnever returns it.",
          "type": "string"
        },
        {
          "const": "organization_limit_exceeded",
          "description": "The account has reached the organization limit.",
          "type": "string"
        }
      ]
    },
    "AccountSubscriptionLimitsResponse": {
      "description": "Organization-related limits for the active subscription.",
      "properties": {
        "invitations_per_day": {
          "description": "Maximum invitations per organization per UTC day.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "members_per_organization": {
          "description": "Maximum members per organization.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "organizations": {
          "description": "Maximum active organizations this account may create.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "projects_per_organization": {
          "description": "Maximum projects per organization.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "organizations",
        "members_per_organization",
        "projects_per_organization",
        "invitations_per_day"
      ],
      "type": "object"
    },
    "AccountSubscriptionNextActionCode": {
      "description": "Stable subscription readiness action code.",
      "oneOf": [
        {
          "const": "choose_plan",
          "description": "Choose a paid plan before organization creation.",
          "type": "string"
        },
        {
          "const": "create_or_manage_organization",
          "description": "Create or manage an organization.",
          "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"
        }
      ]
    },
    "AccountSubscriptionNextActionResponse": {
      "description": "Stable machine-readable subscription readiness action.",
      "properties": {
        "code": {
          "$ref": "#/$defs/AccountSubscriptionNextActionCode",
          "description": "Stable action code."
        },
        "target": {
          "$ref": "#/$defs/AccountSubscriptionNextActionTarget",
          "description": "Stable product surface the client should route to."
        }
      },
      "required": [
        "code",
        "target"
      ],
      "type": "object"
    },
    "AccountSubscriptionNextActionTarget": {
      "description": "Stable subscription 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"
        }
      ]
    },
    "AccountSubscriptionResponse": {
      "description": "Authenticated account subscription response.",
      "properties": {
        "access_state": {
          "$ref": "#/$defs/AccountSubscriptionAccessState",
          "description": "Effective access state derived from subscription state."
        },
        "account_id": {
          "description": "`LogBrew` account identifier.",
          "format": "uuid",
          "type": "string"
        },
        "billing_interval": {
          "$ref": "#/$defs/AccountBillingInterval",
          "description": "Billing interval for the current tier."
        },
        "cancels_at": {
          "description": "Cancellation timestamp, when scheduled and safe to expose.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "current_period_end": {
          "description": "End of the current paid period, when known.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "current_period_start": {
          "description": "Start of the current paid period, when known.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "limits": {
          "$ref": "#/$defs/AccountSubscriptionLimitsResponse",
          "description": "Backend-owned organization-related limits for this subscription."
        },
        "next": {
          "description": "Display-safe next action for subscription and organization readiness.",
          "type": "string"
        },
        "next_action": {
          "$ref": "#/$defs/AccountSubscriptionNextActionResponse",
          "description": "Stable machine-readable action for clients that should not parse `next`."
        },
        "organization_creation_allowed": {
          "description": "Whether this account may create an organization now.",
          "type": "boolean"
        },
        "organization_creation_blocker": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccountSubscriptionBlocker"
            },
            {
              "type": "null"
            }
          ],
          "description": "Stable reason organization creation is blocked, if blocked."
        },
        "renews_at": {
          "description": "Renewal timestamp, when known and safe to expose.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "$ref": "#/$defs/AccountSubscriptionState",
          "description": "Backend-owned subscription state."
        },
        "tier": {
          "$ref": "#/$defs/AccountSubscriptionTier",
          "description": "Current subscription tier."
        }
      },
      "required": [
        "account_id",
        "tier",
        "billing_interval",
        "state",
        "access_state",
        "current_period_start",
        "current_period_end",
        "renews_at",
        "cancels_at",
        "organization_creation_allowed",
        "organization_creation_blocker",
        "limits",
        "next",
        "next_action"
      ],
      "type": "object"
    },
    "AccountSubscriptionState": {
      "description": "Backend-owned subscription state.",
      "oneOf": [
        {
          "const": "free",
          "description": "Free account state.",
          "type": "string"
        },
        {
          "const": "trialing",
          "description": "Trialing paid subscription state.",
          "type": "string"
        },
        {
          "const": "active",
          "description": "Paid subscription in good standing.",
          "type": "string"
        },
        {
          "const": "past_due",
          "description": "Paid subscription is past due.",
          "type": "string"
        },
        {
          "const": "paused",
          "description": "Paid subscription access is paused.",
          "type": "string"
        },
        {
          "const": "canceled",
          "description": "Paid subscription was canceled.",
          "type": "string"
        }
      ]
    },
    "AccountSubscriptionTier": {
      "description": "Current account subscription tier.",
      "oneOf": [
        {
          "const": "free",
          "description": "Free account tier.",
          "type": "string"
        },
        {
          "const": "pro",
          "description": "Pro paid tier.",
          "type": "string"
        },
        {
          "const": "scale",
          "description": "Scale paid tier.",
          "type": "string"
        }
      ]
    },
    "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"
        }
      ]
    },
    "OrganizationResponse": {
      "description": "Organization visible to an authenticated account.",
      "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"
    },
    "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"
        }
      ]
    }
  }
}