<?php

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

declare(strict_types=1);

namespace Dagger;

class Env extends Client\AbstractObject implements Client\IdAble
{
    /**
     * A unique identifier for this Env.
     */
    public function id(): EnvId
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('id');
        return new \Dagger\EnvId((string)$this->queryLeaf($leafQueryBuilder, 'id'));
    }

    /**
     * Retrieves an input binding by name
     */
    public function input(string $name): Binding
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('input');
        $innerQueryBuilder->setArgument('name', $name);
        return new \Dagger\Binding($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns all input bindings provided to the environment
     */
    public function inputs(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('inputs');
        return (array)$this->queryLeaf($leafQueryBuilder, 'inputs');
    }

    /**
     * Retrieves an output binding by name
     */
    public function output(string $name): Binding
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('output');
        $innerQueryBuilder->setArgument('name', $name);
        return new \Dagger\Binding($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns all declared output bindings for the environment
     */
    public function outputs(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('outputs');
        return (array)$this->queryLeaf($leafQueryBuilder, 'outputs');
    }

    /**
     * Create or update a binding of type Address in the environment
     */
    public function withAddressInput(string $name, AddressId|Address $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withAddressInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Address output to be assigned in the environment
     */
    public function withAddressOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withAddressOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type CacheVolume in the environment
     */
    public function withCacheVolumeInput(string $name, CacheVolumeId|CacheVolume $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withCacheVolumeInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired CacheVolume output to be assigned in the environment
     */
    public function withCacheVolumeOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withCacheVolumeOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Changeset in the environment
     */
    public function withChangesetInput(string $name, ChangesetId|Changeset $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withChangesetInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Changeset output to be assigned in the environment
     */
    public function withChangesetOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withChangesetOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Cloud in the environment
     */
    public function withCloudInput(string $name, CloudId|Cloud $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withCloudInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Cloud output to be assigned in the environment
     */
    public function withCloudOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withCloudOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Container in the environment
     */
    public function withContainerInput(string $name, ContainerId|Container $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withContainerInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Container output to be assigned in the environment
     */
    public function withContainerOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withContainerOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Installs the current module into the environment, exposing its functions to the model
     *
     * Contextual path arguments will be populated using the environment's workspace.
     */
    public function withCurrentModule(): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withCurrentModule');
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Directory in the environment
     */
    public function withDirectoryInput(string $name, DirectoryId|Directory $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withDirectoryInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Directory output to be assigned in the environment
     */
    public function withDirectoryOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withDirectoryOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type EnvFile in the environment
     */
    public function withEnvFileInput(string $name, EnvFileId|EnvFile $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withEnvFileInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired EnvFile output to be assigned in the environment
     */
    public function withEnvFileOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withEnvFileOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Env in the environment
     */
    public function withEnvInput(string $name, EnvId|Env $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withEnvInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Env output to be assigned in the environment
     */
    public function withEnvOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withEnvOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type File in the environment
     */
    public function withFileInput(string $name, FileId|File $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withFileInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired File output to be assigned in the environment
     */
    public function withFileOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withFileOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type GitRef in the environment
     */
    public function withGitRefInput(string $name, GitRefId|GitRef $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withGitRefInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired GitRef output to be assigned in the environment
     */
    public function withGitRefOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withGitRefOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type GitRepository in the environment
     */
    public function withGitRepositoryInput(
        string $name,
        GitRepositoryId|GitRepository $value,
        string $description,
    ): Env {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withGitRepositoryInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired GitRepository output to be assigned in the environment
     */
    public function withGitRepositoryOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withGitRepositoryOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type JSONValue in the environment
     */
    public function withJSONValueInput(string $name, JsonValueId|JsonValue $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withJSONValueInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired JSONValue output to be assigned in the environment
     */
    public function withJSONValueOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withJSONValueOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Installs a module into the environment, exposing its functions to the model
     *
     * Contextual path arguments will be populated using the environment's workspace.
     */
    public function withModule(ModuleId|Module $module): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModule');
        $innerQueryBuilder->setArgument('module', $module);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type ModuleConfigClient in the environment
     */
    public function withModuleConfigClientInput(
        string $name,
        ModuleConfigClientId|ModuleConfigClient $value,
        string $description,
    ): Env {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleConfigClientInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired ModuleConfigClient output to be assigned in the environment
     */
    public function withModuleConfigClientOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleConfigClientOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Module in the environment
     */
    public function withModuleInput(string $name, ModuleId|Module $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Module output to be assigned in the environment
     */
    public function withModuleOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type ModuleSource in the environment
     */
    public function withModuleSourceInput(string $name, ModuleSourceId|ModuleSource $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleSourceInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired ModuleSource output to be assigned in the environment
     */
    public function withModuleSourceOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withModuleSourceOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type SearchResult in the environment
     */
    public function withSearchResultInput(string $name, SearchResultId|SearchResult $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSearchResultInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired SearchResult output to be assigned in the environment
     */
    public function withSearchResultOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSearchResultOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type SearchSubmatch in the environment
     */
    public function withSearchSubmatchInput(
        string $name,
        SearchSubmatchId|SearchSubmatch $value,
        string $description,
    ): Env {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSearchSubmatchInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired SearchSubmatch output to be assigned in the environment
     */
    public function withSearchSubmatchOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSearchSubmatchOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Secret in the environment
     */
    public function withSecretInput(string $name, SecretId|Secret $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSecretInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Secret output to be assigned in the environment
     */
    public function withSecretOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSecretOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Service in the environment
     */
    public function withServiceInput(string $name, ServiceId|Service $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withServiceInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Service output to be assigned in the environment
     */
    public function withServiceOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withServiceOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Create or update a binding of type Socket in the environment
     */
    public function withSocketInput(string $name, SocketId|Socket $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSocketInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declare a desired Socket output to be assigned in the environment
     */
    public function withSocketOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withSocketOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Provides a string input binding to the environment
     */
    public function withStringInput(string $name, string $value, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withStringInput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Declares a desired string output binding
     */
    public function withStringOutput(string $name, string $description): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withStringOutput');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('description', $description);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns a new environment with the provided workspace
     */
    public function withWorkspace(DirectoryId|Directory $workspace): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withWorkspace');
        $innerQueryBuilder->setArgument('workspace', $workspace);
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Returns a new environment without any outputs
     */
    public function withoutOutputs(): Env
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withoutOutputs');
        return new \Dagger\Env($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    public function workspace(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('workspace');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }
}
