<?php

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

declare(strict_types=1);

namespace Dagger;

/**
 * Reflective module API provided to functions at runtime.
 */
class CurrentModule extends Client\AbstractObject implements Client\IdAble
{
    /**
     * A unique identifier for this CurrentModule.
     */
    public function id(): CurrentModuleId
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('id');
        return new \Dagger\CurrentModuleId((string)$this->queryLeaf($leafQueryBuilder, 'id'));
    }

    /**
     * The name of the module being executed in
     */
    public function name(): string
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('name');
        return (string)$this->queryLeaf($leafQueryBuilder, 'name');
    }

    /**
     * The directory containing the module's source code loaded into the engine (plus any generated code that may have been created).
     */
    public function source(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('source');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution.
     */
    public function workdir(string $path, ?array $exclude = null, ?array $include = null): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('workdir');
        $innerQueryBuilder->setArgument('path', $path);
        if (null !== $exclude) {
        $innerQueryBuilder->setArgument('exclude', $exclude);
        }
        if (null !== $include) {
        $innerQueryBuilder->setArgument('include', $include);
        }
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.
     */
    public function workdirFile(string $path): File
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('workdirFile');
        $innerQueryBuilder->setArgument('path', $path);
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }
}
