<?php

declare(strict_types=1);

namespace Anthropic\Messages;

use Anthropic\Core\Attributes\Required;
use Anthropic\Core\Concerns\SdkModel;
use Anthropic\Core\Contracts\BaseModel;

/**
 * Tool invocation generated by a server-side tool.
 *
 * @phpstan-type ServerToolCallerShape = array{
 *   toolID: string, type: 'code_execution_20250825'
 * }
 */
final class ServerToolCaller implements BaseModel
{
    /** @use SdkModel<ServerToolCallerShape> */
    use SdkModel;

    /** @var 'code_execution_20250825' $type */
    #[Required]
    public string $type = 'code_execution_20250825';

    #[Required('tool_id')]
    public string $toolID;

    /**
     * `new ServerToolCaller()` is missing required properties by the API.
     *
     * To enforce required parameters use
     * ```
     * ServerToolCaller::with(toolID: ...)
     * ```
     *
     * Otherwise ensure the following setters are called
     *
     * ```
     * (new ServerToolCaller)->withToolID(...)
     * ```
     */
    public function __construct()
    {
        $this->initialize();
    }

    /**
     * Construct an instance from the required parameters.
     *
     * You must use named parameters to construct any parameters with a default value.
     */
    public static function with(string $toolID): self
    {
        $self = new self;

        $self['toolID'] = $toolID;

        return $self;
    }

    public function withToolID(string $toolID): self
    {
        $self = clone $this;
        $self['toolID'] = $toolID;

        return $self;
    }

    /**
     * @param 'code_execution_20250825' $type
     */
    public function withType(string $type): self
    {
        $self = clone $this;
        $self['type'] = $type;

        return $self;
    }
}
