<?php

declare(strict_types=1);

namespace Anthropic\Beta\Webhooks;

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

/**
 * @phpstan-type BetaWebhookSessionThreadIdledEventDataShape = array{
 *   id: string,
 *   organizationID: string,
 *   sessionThreadID: string,
 *   type: 'session.thread_idled',
 *   workspaceID: string,
 * }
 */
final class BetaWebhookSessionThreadIdledEventData implements BaseModel
{
    /** @use SdkModel<BetaWebhookSessionThreadIdledEventDataShape> */
    use SdkModel;

    /** @var 'session.thread_idled' $type */
    #[Required]
    public string $type = 'session.thread_idled';

    /**
     * ID of the session that triggered the event.
     */
    #[Required]
    public string $id;

    #[Required('organization_id')]
    public string $organizationID;

    /**
     * ID of the session thread this event refers to.
     */
    #[Required('session_thread_id')]
    public string $sessionThreadID;

    #[Required('workspace_id')]
    public string $workspaceID;

    /**
     * `new BetaWebhookSessionThreadIdledEventData()` is missing required properties by the API.
     *
     * To enforce required parameters use
     * ```
     * BetaWebhookSessionThreadIdledEventData::with(
     *   id: ..., organizationID: ..., sessionThreadID: ..., workspaceID: ...
     * )
     * ```
     *
     * Otherwise ensure the following setters are called
     *
     * ```
     * (new BetaWebhookSessionThreadIdledEventData)
     *   ->withID(...)
     *   ->withOrganizationID(...)
     *   ->withSessionThreadID(...)
     *   ->withWorkspaceID(...)
     * ```
     */
    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 $id,
        string $organizationID,
        string $sessionThreadID,
        string $workspaceID,
    ): self {
        $self = new self;

        $self['id'] = $id;
        $self['organizationID'] = $organizationID;
        $self['sessionThreadID'] = $sessionThreadID;
        $self['workspaceID'] = $workspaceID;

        return $self;
    }

    /**
     * ID of the session that triggered the event.
     */
    public function withID(string $id): self
    {
        $self = clone $this;
        $self['id'] = $id;

        return $self;
    }

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

        return $self;
    }

    /**
     * ID of the session thread this event refers to.
     */
    public function withSessionThreadID(string $sessionThreadID): self
    {
        $self = clone $this;
        $self['sessionThreadID'] = $sessionThreadID;

        return $self;
    }

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

        return $self;
    }

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

        return $self;
    }
}
