<?php

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

declare(strict_types=1);

namespace Dagger;

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

    /**
     * A description of the error.
     */
    public function message(): string
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('message');
        return (string)$this->queryLeaf($leafQueryBuilder, 'message');
    }

    /**
     * The extensions of the error.
     */
    public function values(): array
    {
        $leafQueryBuilder = new \Dagger\Client\QueryBuilder('values');
        return (array)$this->queryLeaf($leafQueryBuilder, 'values');
    }

    /**
     * Add a value to the error.
     */
    public function withValue(string $name, Json $value): Error
    {
        $innerQueryBuilder = new \Dagger\Client\QueryBuilder('withValue');
        $innerQueryBuilder->setArgument('name', $name);
        $innerQueryBuilder->setArgument('value', $value);
        return new \Dagger\Error($this->client, $this->queryBuilderChain->chain($innerQueryBuilder));
    }
}
