{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trajectory/json-schema/trajectory-add-organization-members-response-schema.json",
  "title": "AddOrganizationMembersResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trajectory-organizations-api-openapi.yml#/components/schemas/AddOrganizationMembersResponse",
  "properties": {
    "organization_name": {
      "type": "string",
      "title": "Organization Name",
      "description": "Display name of the org receiving the invites."
    },
    "members": {
      "items": {
        "$ref": "#/$defs/OrganizationMember"
      },
      "type": "array",
      "title": "Members",
      "description": "Current members of the organization after the request."
    },
    "new_invite_tokens": {
      "items": {
        "$ref": "#/$defs/NewInviteToken"
      },
      "type": "array",
      "title": "New Invite Tokens",
      "description": "Invite tokens generated by this request, paired with their recipient emails.",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "organization_name",
    "members"
  ],
  "$defs": {
    "NewInviteToken": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email",
          "description": "Recipient email the invite was generated for."
        },
        "token": {
          "type": "string",
          "title": "Token",
          "description": "Single-use invite token. Returned only on creation so the API route handler can email it; never re-exposed by the backend."
        }
      },
      "type": "object",
      "required": [
        "email",
        "token"
      ],
      "title": "NewInviteToken"
    },
    "OrganizationMember": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email",
          "description": "Email of the member."
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Display Name",
          "description": "User's display name, when set."
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At",
          "description": "UTC timestamp the membership row was created."
        },
        "status": {
          "$ref": "#/$defs/OrganizationMembershipStatus",
          "description": "Membership status."
        },
        "role": {
          "$ref": "#/$defs/OrganizationRole",
          "description": "Membership role within the organization."
        }
      },
      "type": "object",
      "required": [
        "email",
        "status",
        "role"
      ],
      "title": "OrganizationMember"
    },
    "OrganizationMembershipStatus": {
      "type": "string",
      "enum": [
        "ORG_STATUS_ACTIVE",
        "ORG_STATUS_PENDING",
        "ORG_STATUS_DISABLED"
      ],
      "title": "OrganizationMembershipStatus"
    },
    "OrganizationRole": {
      "type": "string",
      "enum": [
        "ORG_ROLE_OWNER",
        "ORG_ROLE_ADMIN",
        "ORG_ROLE_MEMBER"
      ],
      "title": "OrganizationRole"
    }
  }
}