<?php

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

declare(strict_types=1);

namespace Dagger;

/**
 * A standardized address to load containers, directories, secrets, and other object types. Address format depends on the type, and is validated at type selection.
 */
class Address extends Client\AbstractObject implements Client\IdAble
{
    /**
     * Load a container from the address.
     */
    public function container(): Container
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('container');
        return new \Dagger\Container($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a directory from the address.
     */
    public function directory(?array $exclude = null, ?array $include = null, ?bool $noCache = false): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('directory');
        if (null !== $exclude) {
        $innerQueryBuilder->setArgument('exclude', $exclude);
        }
        if (null !== $include) {
        $innerQueryBuilder->setArgument('include', $include);
        }
        if (null !== $noCache) {
        $innerQueryBuilder->setArgument('noCache', $noCache);
        }
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a file from the address.
     */
    public function file(?array $exclude = null, ?array $include = null, ?bool $noCache = false): File
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('file');
        if (null !== $exclude) {
        $innerQueryBuilder->setArgument('exclude', $exclude);
        }
        if (null !== $include) {
        $innerQueryBuilder->setArgument('include', $include);
        }
        if (null !== $noCache) {
        $innerQueryBuilder->setArgument('noCache', $noCache);
        }
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a git ref (branch, tag or commit) from the address.
     */
    public function gitRef(): GitRef
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('gitRef');
        return new \Dagger\GitRef($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a git repository from the address.
     */
    public function gitRepository(): GitRepository
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('gitRepository');
        return new \Dagger\GitRepository($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * A unique identifier for this Address.
     */
    public function id(): AddressId
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('id');
        return new \Dagger\AddressId((string)$this->queryLeaf($leafQueryBuilder, 'id'));
    }

    /**
     * Load a secret from the address.
     */
    public function secret(): Secret
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('secret');
        return new \Dagger\Secret($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a service from the address.
     */
    public function service(): Service
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('service');
        return new \Dagger\Service($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a local socket from the address.
     */
    public function socket(): Socket
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('socket');
        return new \Dagger\Socket($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The address value
     */
    public function value(): string
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('value');
        return (string)$this->queryLeaf($leafQueryBuilder, 'value');
    }
}
