<?php

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

declare(strict_types=1);

namespace Dagger;

/**
 * A comparison between two directories representing changes that can be applied.
 */
class Changeset extends Client\AbstractObject implements Client\IdAble
{
    /**
     * Files and directories that were added in the newer directory.
     */
    public function addedPaths(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('addedPaths');
        return (array)$this->queryLeaf($leafQueryBuilder, 'addedPaths');
    }

    /**
     * The newer/upper snapshot.
     */
    public function after(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('after');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Return a Git-compatible patch of the changes
     */
    public function asPatch(): File
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('asPatch');
        return new \Dagger\File($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * The older/lower snapshot to compare against.
     */
    public function before(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('before');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Applies the diff represented by this changeset to a path on the host.
     */
    public function export(string $path): string
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('export');
        $leafQueryBuilder->setArgument('path', $path);
        return (string)$this->queryLeaf($leafQueryBuilder, 'export');
    }

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

    /**
     * Return a snapshot containing only the created and modified files
     */
    public function layer(): Directory
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('layer');
        return new \Dagger\Directory($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }

    /**
     * Files and directories that existed before and were updated in the newer directory.
     */
    public function modifiedPaths(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('modifiedPaths');
        return (array)$this->queryLeaf($leafQueryBuilder, 'modifiedPaths');
    }

    /**
     * Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included.
     */
    public function removedPaths(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('removedPaths');
        return (array)$this->queryLeaf($leafQueryBuilder, 'removedPaths');
    }

    /**
     * Force evaluation in the engine.
     */
    public function sync(): ChangesetId
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('sync');
        return new \Dagger\ChangesetId((string)$this->queryLeaf($leafQueryBuilder, 'sync'));
    }
}
