scalar JSON

"""
Result type for internalIdentityByEmail query.
Returns either the Identity if found, or an error object if the request failed.
"""
union InternalIdentityByEmailResult = Identity | InternalIdentityByEmailError

"""
Query is used to fetch data about users and their identities.
"""
type Query {
    account: Account
        @deprecated(reason: "Use `Query.identityById`")
        @override(from: "graphql-product")
    # Active user
    activeProfile: Profile!

    """
    Available feature flags
    """
    features(
        """
        The ID of the identity used to fetch personalized feature flags
        """
        identityId: String
        """
        The brand context (e.g., "awal") to scope brand-specific flags
        """
        brandExperience: BrandExperience
        """
        Filters flags by name prefix (e.g., "app_name_")
        """
        prefixFilter: String
    ): [Feature!]!

    # Getting OA role for a given logged in user
    getOaUserRoles: [OaUserRole!]!

    # All identity queries
    identityByEmail(email: String): Identity
    identityById(identityId: String): Identity

    # all subscriptions queries
    identitySubscriptions(
        appId: ApplicationType @deprecated(reason: "Use appIds")
        appIds: [ApplicationType!]
        notificationType: String
        # This explicitly passed identity ID is used to fetch subscriptions for
        # an arbitrary user if the requesting admin can administer it.
        identityId: ID
    ): [UserSubscription!]

    # Get employees by search term
    internalIdentities(term: String!): [Identity!]! @tag(name: "internal")

    """
    Search for an internal employee identity by email address.
    Returns the identity if found, null if not found, or an error object for invalid requests.
    Only returns identities where isEmployee = true.
    Only accessible by users with internal admin privileges.
    """
    internalIdentityByEmail(email: String!): InternalIdentityByEmailResult
        @tag(name: "internal")

    orchAdminUsers(filter: OrchAdminUserFilter! = {}): OrchAdminUserResult!

    # all resource queries
    resourceByUUID(uuid: String): GenericResource

    # all profile queries
    usersForAdmin(
        active: Boolean
        pending: Boolean
        applications: [ApplicationType]
        featureFlag: String
        labelparticipants: [Int]
        limit: Int
        offset: Int
        resourceAccess: [String]
        parentVendorFilter: [String!]
        term: String
        includeSubaccountUsers: Boolean
        includeRequester: Boolean
    ): UserResults!
}
