<?php

/**
 * This class has been generated by dagger-php-sdk. DO NOT EDIT.
 */

declare(strict_types=1);

namespace Dagger;

/**
 * The root of the DAG.
 */
class Client extends Client\AbstractClient
{
    /**
     * initialize an address to load directories, containers, secrets or other object types.
     */
    public function address(string $value): Address
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('address');
        $innerQueryBuilder->setArgument('value', $value);
        return new \Dagger\Address($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Constructs a cache volume for a given cache key.
     */
    public function cacheVolume(string $key): CacheVolume
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('cacheVolume');
        $innerQueryBuilder->setArgument('key', $key);
        return new \Dagger\CacheVolume($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Dagger Cloud configuration and state
     */
    public function cloud(): Cloud
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('cloud');
        return new \Dagger\Cloud($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Creates a scratch container, with no image or metadata.
     *
     * To pull an image, follow up with the "from" function.
     */
    public function container(?Platform $platform = null): Container
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('container');
        if (null !== $platform) {
        $innerQueryBuilder->setArgument('platform', $platform);
        }
        return new \Dagger\Container($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns the current environment
     *
     * When called from a function invoked via an LLM tool call, this will be the LLM's current environment, including any modifications made through calling tools. Env values returned by functions become the new environment for subsequent calls, and Changeset values returned by functions are applied to the environment's workspace.
     *
     * When called from a module function outside of an LLM, this returns an Env with the current module installed, and with the current module's source directory as its workspace.
     */
    public function currentEnv(): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('currentEnv');
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The FunctionCall context that the SDK caller is currently executing in.
     *
     * If the caller is not currently executing in a function, this will return an error.
     */
    public function currentFunctionCall(): FunctionCall
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('currentFunctionCall');
        return new \Dagger\FunctionCall($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The module currently being served in the session, if any.
     */
    public function currentModule(): CurrentModule
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('currentModule');
        return new \Dagger\CurrentModule($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The TypeDef representations of the objects currently being served in the session.
     */
    public function currentTypeDefs(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('currentTypeDefs');
        return (array)$this->queryLeaf($leafQueryBuilder, 'currentTypeDefs');
    }

    /**
     * The default platform of the engine.
     */
    public function defaultPlatform(): Platform
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('defaultPlatform');
        return new \Dagger\Platform((string)$this->queryLeaf($leafQueryBuilder, 'defaultPlatform'));
    }

    /**
     * Creates an empty directory.
     */
    public function directory(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('directory');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The Dagger engine container configuration and state
     */
    public function engine(): Engine
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('engine');
        return new \Dagger\Engine($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Initializes a new environment
     */
    public function env(?bool $privileged = false, ?bool $writable = false): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('env');
        if (null !== $privileged) {
        $innerQueryBuilder->setArgument('privileged', $privileged);
        }
        if (null !== $writable) {
        $innerQueryBuilder->setArgument('writable', $writable);
        }
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Initialize an environment file
     */
    public function envFile(?bool $expand = null): EnvFile
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('envFile');
        if (null !== $expand) {
        $innerQueryBuilder->setArgument('expand', $expand);
        }
        return new \Dagger\EnvFile($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create a new error.
     */
    public function error(string $message): Error
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('error');
        $innerQueryBuilder->setArgument('message', $message);
        return new \Dagger\Error($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Creates a file with the specified contents.
     */
    public function file(string $name, string $contents, ?int $permissions = 420): File
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('file');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('contents', $contents);
        if (null !== $permissions) {
        $innerQueryBuilder->setArgument('permissions', $permissions);
        }
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Creates a function.
     */
    public function function(string $name, TypeDefId|TypeDef $returnType): Function_
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('function');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('returnType', $returnType);
        return new \Dagger\Function_($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create a code generation result, given a directory containing the generated code.
     */
    public function generatedCode(DirectoryId|Directory $code): GeneratedCode
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('generatedCode');
        $innerQueryBuilder->setArgument('code', $code);
        return new \Dagger\GeneratedCode($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Queries a Git repository.
     */
    public function git(
        string $url,
        ?bool $keepGitDir = true,
        ?string $sshKnownHosts = '',
        SocketId|Socket|null $sshAuthSocket = null,
        ?string $httpAuthUsername = '',
        SecretId|Secret|null $httpAuthToken = null,
        SecretId|Secret|null $httpAuthHeader = null,
        ServiceId|Service|null $experimentalServiceHost = null,
    ): GitRepository {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('git');
        $innerQueryBuilder->setArgument('url', $url);
        if (null !== $keepGitDir) {
        $innerQueryBuilder->setArgument('keepGitDir', $keepGitDir);
        }
        if (null !== $sshKnownHosts) {
        $innerQueryBuilder->setArgument('sshKnownHosts', $sshKnownHosts);
        }
        if (null !== $sshAuthSocket) {
        $innerQueryBuilder->setArgument('sshAuthSocket', $sshAuthSocket);
        }
        if (null !== $httpAuthUsername) {
        $innerQueryBuilder->setArgument('httpAuthUsername', $httpAuthUsername);
        }
        if (null !== $httpAuthToken) {
        $innerQueryBuilder->setArgument('httpAuthToken', $httpAuthToken);
        }
        if (null !== $httpAuthHeader) {
        $innerQueryBuilder->setArgument('httpAuthHeader', $httpAuthHeader);
        }
        if (null !== $experimentalServiceHost) {
        $innerQueryBuilder->setArgument('experimentalServiceHost', $experimentalServiceHost);
        }
        return new \Dagger\GitRepository($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Queries the host environment.
     */
    public function host(): Host
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('host');
        return new \Dagger\Host($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns a file containing an http remote url content.
     */
    public function http(
        string $url,
        ?string $name = null,
        ?int $permissions = null,
        SecretId|Secret|null $authHeader = null,
        ServiceId|Service|null $experimentalServiceHost = null,
    ): File {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('http');
        $innerQueryBuilder->setArgument('url', $url);
        if (null !== $name) {
        $innerQueryBuilder->setArgument('name', $name);
        }
        if (null !== $permissions) {
        $innerQueryBuilder->setArgument('permissions', $permissions);
        }
        if (null !== $authHeader) {
        $innerQueryBuilder->setArgument('authHeader', $authHeader);
        }
        if (null !== $experimentalServiceHost) {
        $innerQueryBuilder->setArgument('experimentalServiceHost', $experimentalServiceHost);
        }
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Initialize a JSON value
     */
    public function json(): JsonValue
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('json');
        return new \Dagger\JsonValue($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Initialize a Large Language Model (LLM)
     */
    public function llm(?string $model = null, ?int $maxAPICalls = null): LLM
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('llm');
        if (null !== $model) {
        $innerQueryBuilder->setArgument('model', $model);
        }
        if (null !== $maxAPICalls) {
        $innerQueryBuilder->setArgument('maxAPICalls', $maxAPICalls);
        }
        return new \Dagger\LLM($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Address from its ID.
     */
    public function loadAddressFromID(AddressId|Address $id): Address
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadAddressFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Address($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Binding from its ID.
     */
    public function loadBindingFromID(BindingId|Binding $id): Binding
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadBindingFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Binding($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a CacheVolume from its ID.
     */
    public function loadCacheVolumeFromID(CacheVolumeId|CacheVolume $id): CacheVolume
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadCacheVolumeFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\CacheVolume($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Changeset from its ID.
     */
    public function loadChangesetFromID(ChangesetId|Changeset $id): Changeset
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadChangesetFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Changeset($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Cloud from its ID.
     */
    public function loadCloudFromID(CloudId|Cloud $id): Cloud
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadCloudFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Cloud($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Container from its ID.
     */
    public function loadContainerFromID(ContainerId|Container $id): Container
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadContainerFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Container($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a CurrentModule from its ID.
     */
    public function loadCurrentModuleFromID(CurrentModuleId|CurrentModule $id): CurrentModule
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadCurrentModuleFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\CurrentModule($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Directory from its ID.
     */
    public function loadDirectoryFromID(DirectoryId|Directory $id): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadDirectoryFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EngineCacheEntry from its ID.
     */
    public function loadEngineCacheEntryFromID(EngineCacheEntryId|EngineCacheEntry $id): EngineCacheEntry
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEngineCacheEntryFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EngineCacheEntry($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EngineCacheEntrySet from its ID.
     */
    public function loadEngineCacheEntrySetFromID(EngineCacheEntrySetId|EngineCacheEntrySet $id): EngineCacheEntrySet
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEngineCacheEntrySetFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EngineCacheEntrySet($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EngineCache from its ID.
     */
    public function loadEngineCacheFromID(EngineCacheId|EngineCache $id): EngineCache
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEngineCacheFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EngineCache($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Engine from its ID.
     */
    public function loadEngineFromID(EngineId|Engine $id): Engine
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEngineFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Engine($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EnumTypeDef from its ID.
     */
    public function loadEnumTypeDefFromID(EnumTypeDefId|EnumTypeDef $id): EnumTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEnumTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EnumTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EnumValueTypeDef from its ID.
     */
    public function loadEnumValueTypeDefFromID(EnumValueTypeDefId|EnumValueTypeDef $id): EnumValueTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEnumValueTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EnumValueTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EnvFile from its ID.
     */
    public function loadEnvFileFromID(EnvFileId|EnvFile $id): EnvFile
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEnvFileFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EnvFile($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Env from its ID.
     */
    public function loadEnvFromID(EnvId|Env $id): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEnvFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a EnvVariable from its ID.
     */
    public function loadEnvVariableFromID(EnvVariableId|EnvVariable $id): EnvVariable
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadEnvVariableFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\EnvVariable($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Error from its ID.
     */
    public function loadErrorFromID(ErrorId|Error $id): Error
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadErrorFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Error($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ErrorValue from its ID.
     */
    public function loadErrorValueFromID(ErrorValueId|ErrorValue $id): ErrorValue
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadErrorValueFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ErrorValue($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a FieldTypeDef from its ID.
     */
    public function loadFieldTypeDefFromID(FieldTypeDefId|FieldTypeDef $id): FieldTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFieldTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\FieldTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a File from its ID.
     */
    public function loadFileFromID(FileId|File $id): File
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFileFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a FunctionArg from its ID.
     */
    public function loadFunctionArgFromID(FunctionArgId|FunctionArg $id): FunctionArg
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFunctionArgFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\FunctionArg($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a FunctionCallArgValue from its ID.
     */
    public function loadFunctionCallArgValueFromID(
        FunctionCallArgValueId|FunctionCallArgValue $id,
    ): FunctionCallArgValue {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFunctionCallArgValueFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\FunctionCallArgValue($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a FunctionCall from its ID.
     */
    public function loadFunctionCallFromID(FunctionCallId|FunctionCall $id): FunctionCall
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFunctionCallFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\FunctionCall($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Function from its ID.
     */
    public function loadFunctionFromID(FunctionId|Function_ $id): Function_
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadFunctionFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Function_($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a GeneratedCode from its ID.
     */
    public function loadGeneratedCodeFromID(GeneratedCodeId|GeneratedCode $id): GeneratedCode
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadGeneratedCodeFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\GeneratedCode($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a GitRef from its ID.
     */
    public function loadGitRefFromID(GitRefId|GitRef $id): GitRef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadGitRefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\GitRef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a GitRepository from its ID.
     */
    public function loadGitRepositoryFromID(GitRepositoryId|GitRepository $id): GitRepository
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadGitRepositoryFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\GitRepository($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Host from its ID.
     */
    public function loadHostFromID(HostId|Host $id): Host
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadHostFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Host($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a InputTypeDef from its ID.
     */
    public function loadInputTypeDefFromID(InputTypeDefId|InputTypeDef $id): InputTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadInputTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\InputTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a InterfaceTypeDef from its ID.
     */
    public function loadInterfaceTypeDefFromID(InterfaceTypeDefId|InterfaceTypeDef $id): InterfaceTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadInterfaceTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\InterfaceTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a JSONValue from its ID.
     */
    public function loadJSONValueFromID(JsonValueId|JsonValue $id): JsonValue
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadJSONValueFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\JsonValue($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a LLM from its ID.
     */
    public function loadLLMFromID(LLMId|LLM $id): LLM
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadLLMFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\LLM($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a LLMTokenUsage from its ID.
     */
    public function loadLLMTokenUsageFromID(LLMTokenUsageId|LLMTokenUsage $id): LLMTokenUsage
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadLLMTokenUsageFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\LLMTokenUsage($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Label from its ID.
     */
    public function loadLabelFromID(LabelId|Label $id): Label
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadLabelFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Label($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ListTypeDef from its ID.
     */
    public function loadListTypeDefFromID(ListTypeDefId|ListTypeDef $id): ListTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadListTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ListTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ModuleConfigClient from its ID.
     */
    public function loadModuleConfigClientFromID(ModuleConfigClientId|ModuleConfigClient $id): ModuleConfigClient
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadModuleConfigClientFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ModuleConfigClient($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Module from its ID.
     */
    public function loadModuleFromID(ModuleId|Module $id): Module
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadModuleFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Module($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ModuleSource from its ID.
     */
    public function loadModuleSourceFromID(ModuleSourceId|ModuleSource $id): ModuleSource
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadModuleSourceFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ModuleSource($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ObjectTypeDef from its ID.
     */
    public function loadObjectTypeDefFromID(ObjectTypeDefId|ObjectTypeDef $id): ObjectTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadObjectTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ObjectTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Port from its ID.
     */
    public function loadPortFromID(PortId|Port $id): Port
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadPortFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Port($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a SDKConfig from its ID.
     */
    public function loadSDKConfigFromID(SDKConfigId|SDKConfig $id): SDKConfig
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSDKConfigFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\SDKConfig($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a ScalarTypeDef from its ID.
     */
    public function loadScalarTypeDefFromID(ScalarTypeDefId|ScalarTypeDef $id): ScalarTypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadScalarTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\ScalarTypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a SearchResult from its ID.
     */
    public function loadSearchResultFromID(SearchResultId|SearchResult $id): SearchResult
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSearchResultFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\SearchResult($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a SearchSubmatch from its ID.
     */
    public function loadSearchSubmatchFromID(SearchSubmatchId|SearchSubmatch $id): SearchSubmatch
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSearchSubmatchFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\SearchSubmatch($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Secret from its ID.
     */
    public function loadSecretFromID(SecretId|Secret $id): Secret
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSecretFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Secret($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Service from its ID.
     */
    public function loadServiceFromID(ServiceId|Service $id): Service
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadServiceFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Service($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Socket from its ID.
     */
    public function loadSocketFromID(SocketId|Socket $id): Socket
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSocketFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Socket($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a SourceMap from its ID.
     */
    public function loadSourceMapFromID(SourceMapId|SourceMap $id): SourceMap
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadSourceMapFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\SourceMap($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a Terminal from its ID.
     */
    public function loadTerminalFromID(TerminalId|Terminal $id): Terminal
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadTerminalFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\Terminal($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a TypeDef from its ID.
     */
    public function loadTypeDefFromID(TypeDefId|TypeDef $id): TypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('loadTypeDefFromID');
        $innerQueryBuilder->setArgument('id', $id);
        return new \Dagger\TypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create a new module.
     */
    public function module(): Module
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('module');
        return new \Dagger\Module($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create a new module source instance from a source ref string
     */
    public function moduleSource(
        string $refString,
        ?string $refPin = '',
        ?bool $disableFindUp = false,
        ?bool $allowNotExists = false,
        ?ModuleSourceKind $requireKind = null,
    ): ModuleSource {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('moduleSource');
        $innerQueryBuilder->setArgument('refString', $refString);
        if (null !== $refPin) {
        $innerQueryBuilder->setArgument('refPin', $refPin);
        }
        if (null !== $disableFindUp) {
        $innerQueryBuilder->setArgument('disableFindUp', $disableFindUp);
        }
        if (null !== $allowNotExists) {
        $innerQueryBuilder->setArgument('allowNotExists', $allowNotExists);
        }
        if (null !== $requireKind) {
        $innerQueryBuilder->setArgument('requireKind', $requireKind);
        }
        return new \Dagger\ModuleSource($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Creates a new secret.
     */
    public function secret(string $uri, ?string $cacheKey = null): Secret
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('secret');
        $innerQueryBuilder->setArgument('uri', $uri);
        if (null !== $cacheKey) {
        $innerQueryBuilder->setArgument('cacheKey', $cacheKey);
        }
        return new \Dagger\Secret($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Sets a secret given a user defined name to its plaintext and returns the secret.
     *
     * The plaintext value is limited to a size of 128000 bytes.
     */
    public function setSecret(string $name, string $plaintext): Secret
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('setSecret');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('plaintext', $plaintext);
        return new \Dagger\Secret($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Creates source map metadata.
     */
    public function sourceMap(string $filename, int $line, int $column): SourceMap
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('sourceMap');
        $innerQueryBuilder->setArgument('filename', $filename);
        $innerQueryBuilder->setArgument('line', $line);
        $innerQueryBuilder->setArgument('column', $column);
        return new \Dagger\SourceMap($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create a new TypeDef.
     */
    public function typeDef(): TypeDef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('typeDef');
        return new \Dagger\TypeDef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Get the current Dagger Engine version.
     */
    public function version(): string
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('version');
        return (string)$this->queryLeaf($leafQueryBuilder, 'version');
    }
}
