{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.api.search/atlassian/organization",
  "title": "Atlassian Organization",
  "description": "Schema representing an Atlassian organization and its related entities including users, domains, policies, events, and groups as managed through the Atlassian Admin API.",
  "type": "object",
  "definitions": {
    "Organization": {
      "type": "object",
      "description": "Represents an Atlassian Cloud organization that serves as the top-level administrative entity for managing users, products, and policies.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the organization."
        },
        "type": {
          "type": "string",
          "const": "organization",
          "description": "The resource type identifier."
        },
        "attributes": {
          "type": "object",
          "description": "The core attributes of the organization.",
          "properties": {
            "name": {
              "type": "string",
              "description": "The display name of the organization."
            }
          },
          "required": ["name"]
        }
      },
      "required": ["id", "type", "attributes"]
    },
    "User": {
      "type": "object",
      "description": "Represents a user account within an Atlassian organization, including their profile information, account status, and product access.",
      "properties": {
        "account_id": {
          "type": "string",
          "description": "The unique Atlassian account identifier for the user."
        },
        "account_type": {
          "type": "string",
          "description": "The type of Atlassian account.",
          "enum": ["atlassian", "customer", "app"]
        },
        "account_status": {
          "type": "string",
          "description": "The current lifecycle status of the account.",
          "enum": ["active", "inactive", "closed"]
        },
        "name": {
          "type": "string",
          "description": "The display name of the user."
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "The email address associated with the user account."
        },
        "picture": {
          "type": "string",
          "format": "uri",
          "description": "URL pointing to the user's profile picture."
        },
        "nickname": {
          "type": "string",
          "description": "The nickname or short name for the user."
        },
        "last_active": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of when the user was last active."
        },
        "created": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of when the user account was created."
        },
        "product_access": {
          "type": "array",
          "description": "List of Atlassian products the user has access to.",
          "items": {
            "$ref": "#/definitions/ProductAccess"
          }
        }
      },
      "required": ["account_id", "account_type", "account_status", "name"]
    },
    "ProductAccess": {
      "type": "object",
      "description": "Represents a user's access to a specific Atlassian product.",
      "properties": {
        "key": {
          "type": "string",
          "description": "The product key identifier (e.g., jira-software, confluence)."
        },
        "name": {
          "type": "string",
          "description": "The display name of the product."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The URL of the product site instance."
        },
        "last_active": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of when the user last accessed this product."
        }
      },
      "required": ["key", "name"]
    },
    "Domain": {
      "type": "object",
      "description": "Represents a verified or pending domain associated with an Atlassian organization, used for user account claiming and identity management.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the domain."
        },
        "type": {
          "type": "string",
          "const": "domain",
          "description": "The resource type identifier."
        },
        "attributes": {
          "type": "object",
          "description": "The core attributes of the domain.",
          "properties": {
            "name": {
              "type": "string",
              "description": "The domain name (e.g., example.com)."
            },
            "claim": {
              "type": "object",
              "description": "The verification claim details for the domain.",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "The method used to verify domain ownership.",
                  "enum": ["http", "dns", "verified"]
                },
                "status": {
                  "type": "string",
                  "description": "The current verification status of the domain.",
                  "enum": ["verified", "pending"]
                }
              },
              "required": ["type", "status"]
            }
          },
          "required": ["name"]
        }
      },
      "required": ["id", "type", "attributes"]
    },
    "Policy": {
      "type": "object",
      "description": "Represents an organization-level policy that defines governance rules and controls for security, authentication, data residency, and access management.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the policy."
        },
        "type": {
          "type": "string",
          "description": "The category of policy.",
          "enum": ["ip-allowlist", "data-residency", "authentication", "external-user", "user-security"]
        },
        "name": {
          "type": "string",
          "description": "The display name of the policy."
        },
        "status": {
          "type": "string",
          "description": "Whether the policy is currently active.",
          "enum": ["enabled", "disabled"]
        },
        "attributes": {
          "type": "object",
          "description": "Policy-specific configuration settings. The structure varies by policy type.",
          "additionalProperties": true
        },
        "resources": {
          "type": "array",
          "description": "The resources (products, sites) this policy applies to.",
          "items": {
            "$ref": "#/definitions/PolicyResource"
          }
        },
        "created": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of when the policy was created."
        },
        "updated": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp of when the policy was last modified."
        }
      },
      "required": ["id", "type", "name", "status"]
    },
    "PolicyResource": {
      "type": "object",
      "description": "A resource that a policy applies to.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The identifier of the resource."
        },
        "type": {
          "type": "string",
          "description": "The type of resource (e.g., product, site)."
        }
      },
      "required": ["id", "type"]
    },
    "Event": {
      "type": "object",
      "description": "Represents an audit event that records an action performed within the Atlassian organization, used for security monitoring and compliance.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the event."
        },
        "type": {
          "type": "string",
          "const": "event",
          "description": "The resource type identifier."
        },
        "attributes": {
          "type": "object",
          "description": "The details of the audit event.",
          "properties": {
            "time": {
              "type": "string",
              "format": "date-time",
              "description": "ISO 8601 timestamp of when the event occurred."
            },
            "action": {
              "type": "string",
              "description": "The action that was performed (e.g., user_added, policy_updated)."
            },
            "actor": {
              "$ref": "#/definitions/EventActor"
            },
            "context": {
              "type": "array",
              "description": "Key-value pairs providing additional context about the event.",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": ["key", "value"]
              }
            },
            "container": {
              "type": "array",
              "description": "Containers (organizations, sites) related to the event.",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                }
              }
            },
            "location": {
              "$ref": "#/definitions/EventLocation"
            }
          },
          "required": ["time", "action", "actor"]
        }
      },
      "required": ["id", "type", "attributes"]
    },
    "EventActor": {
      "type": "object",
      "description": "The entity (user, system, or application) that performed an action.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The identifier of the actor."
        },
        "name": {
          "type": "string",
          "description": "The display name of the actor."
        },
        "type": {
          "type": "string",
          "description": "The type of entity that performed the action.",
          "enum": ["user", "system", "app"]
        },
        "links": {
          "type": "object",
          "properties": {
            "self": {
              "type": "string",
              "format": "uri",
              "description": "API link to the actor resource."
            }
          }
        }
      },
      "required": ["id", "type"]
    },
    "EventLocation": {
      "type": "object",
      "description": "Geographic and network location information for an event.",
      "properties": {
        "ip": {
          "type": "string",
          "description": "The IP address from which the event originated."
        },
        "geo": {
          "type": "string",
          "description": "The geographic location derived from the IP address."
        }
      }
    },
    "Group": {
      "type": "object",
      "description": "Represents a group within an Atlassian organization used to organize users and assign collective permissions.",
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the group."
        },
        "type": {
          "type": "string",
          "const": "group",
          "description": "The resource type identifier."
        },
        "attributes": {
          "type": "object",
          "description": "The core attributes of the group.",
          "properties": {
            "name": {
              "type": "string",
              "description": "The display name of the group."
            },
            "description": {
              "type": "string",
              "description": "A text description of the group's purpose."
            },
            "member_count": {
              "type": "integer",
              "description": "The number of members currently in the group."
            }
          },
          "required": ["name"]
        }
      },
      "required": ["id", "type", "attributes"]
    },
    "RoleAssignment": {
      "type": "object",
      "description": "Represents a role granted to a user for a specific resource.",
      "properties": {
        "role": {
          "type": "string",
          "description": "The role identifier (e.g., org-admin, trusted-user, user)."
        },
        "resource": {
          "type": "object",
          "description": "The resource the role is scoped to.",
          "properties": {
            "id": {
              "type": "string",
              "description": "The resource identifier."
            },
            "type": {
              "type": "string",
              "description": "The resource type."
            }
          },
          "required": ["id", "type"]
        }
      },
      "required": ["role", "resource"]
    },
    "PaginationLinks": {
      "type": "object",
      "description": "Cursor-based pagination links for navigating result sets.",
      "properties": {
        "self": {
          "type": "string",
          "format": "uri",
          "description": "Link to the current page of results."
        },
        "next": {
          "type": "string",
          "format": "uri",
          "description": "Link to the next page of results. Absent if on the last page."
        },
        "prev": {
          "type": "string",
          "format": "uri",
          "description": "Link to the previous page of results. Absent if on the first page."
        }
      }
    }
  },
  "$ref": "#/definitions/Organization"
}
