# Scalars resolved by package "graphql-scalars"
scalar DateTime
scalar Time
scalar JSONObject

type Query {
    """
    Returns the API build version.
    """
    apiVersion: String!

    """
    Returns the version of the connected Zabbix instance.
    """
    zabbixVersion: String

    """
    Logs in to Zabbix. This is primarily for debugging and testing.
    The returned authentication token can be passed in the `zabbix-auth-token` header for future requests.
    Alternatively, the `zbx_session` cookie can be used for authentication.
    """
    login(
        """Zabbix username."""
        username: String!, 
        """Zabbix password."""
        password: String!
    ): String

    """
    Logs out from Zabbix, invalidating the current session/token.
    """
    logout: Boolean

    """
    Returns all hosts and their items.
    
    Authentication: Requires `zbx_session` cookie or `zabbix-auth-token` header.
    """
    allHosts(
        """Wildcard name pattern for filtering hosts (LIKE '%...%')."""
        name_pattern: String = "", 
        """Filter hosts by their technical name."""
        filter_host: String = null, 
        """Filter by a specific host ID."""
        hostids: Int,
        """Filter by host group IDs."""
        groupids:[Int!] = null, 
        """If true, only returns hosts that have items attached."""
        with_items: Boolean = false, 
        """Filter by `deviceType` tag."""
        tag_deviceType:[String]=[], 
        """Filter by `hostType` tag."""
        tag_hostType:[String!]
    ): [Host]

    """
    Returns all devices and their items. Devices are hosts with a `deviceType` and a state.
    
    Authentication: Requires `zbx_session` cookie or `zabbix-auth-token` header.
    """
    allDevices(
        """Wildcard name pattern for filtering devices (LIKE '%...%')."""
        name_pattern: String = "", 
        """Filter devices by their technical name."""
        filter_host: String = null, 
        """Filter by a specific host ID."""
        hostids: Int,
        """Filter by host group IDs."""
        groupids:[Int!] = null, 
        """If true, only returns devices that have items attached."""
        with_items: Boolean = false, 
        """Filter by `deviceType` tag."""
        tag_deviceType:[String]=[], 
        """Filter by `hostType` tag."""
        tag_hostType:[String!]
    ): [Device]

    """
    Returns all host groups.
    
    Authentication: Requires `zbx_session` cookie or `zabbix-auth-token` header.
    """
    allHostGroups(
        """Search for host groups by name (supports wildcards)."""
        search_name: String, 
        """If true, only returns groups that have hosts attached."""
        with_hosts: Boolean = true
    ): [HostGroup]


    """
    Returns all locations used by hosts.
    
    Authentication: Requires `zbx_session` cookie or `zabbix-auth-token` header.
    """
    locations(
        """Regex name pattern for filtering locations."""
        name_pattern: String = "", 
        """If true, filters the result for distinct names."""
        distinct_by_name: Boolean = true, 
        """Filter by template IDs used by the hosts."""
        templateids:[String] = null
    ): [Location]

    """
    Exports value history for Zabbix items.
    
    Authentication: Requires `zbx_session` cookie or `zabbix-auth-token` header.
    """
    exportHostValueHistory(
        """Optional list of hostnames to be included in the result."""
        host_filter: [String!],
        """Optional list of item keys to be included in the result."""
        itemKey_filter: [String!],
        """Timestamp of the earliest value to include."""
        time_from: DateTime,
        """Timestamp of the last value to include."""
        time_until: DateTime,
        """Sort order for the results (asc or desc)."""
        sortOrder: SortOrder=desc,
        """Maximum number of records to return."""
        limit: Int,
        """The data type of the values being retrieved."""
        type: StorageItemType = FLOAT
    ): GenericResponse

    """
    Returns all user permissions. 
    If `objectNames` is provided, returns only the permissions related to those objects.
    """
    userPermissions(
        """Optional list of object names to filter by."""
        objectNames: [String!]
    ): [UserPermission!]

    """
    Checks if the current user has the requested permissions.
    """
    hasPermissions(
        """List of permissions to check."""
        permissions: [PermissionRequest!]!
    ): Boolean


    """
    Exports user rights (roles and groups).
    """
    exportUserRights(
        """Wildcard name pattern for filtering (LIKE '%...%')."""
        name_pattern: String = "" 
        """Regex to exclude matching host groups from group permissions."""
        exclude_hostgroups_pattern: String = ""
    ): UserRights

    """
    Returns templates.
    """
    templates(
        """Filter by specific template IDs."""
        hostids: [Int], 
        """Wildcard name pattern for filtering templates."""
        name_pattern: String
    ): [Template]

    """
    Returns all template groups.
    """
    allTemplateGroups(
        """Wildcard name pattern for filtering template groups."""
        name_pattern: String
    ): [HostGroup]
}

