<?php

declare(strict_types=1);

namespace ImovelZapAi\AiGateway\Application\Data;

use ImovelZapAi\AiGateway\Domain\Enums\AiTaskType;

final readonly class AiCompletionRequest
{
    /**
     * @param  list<AiMessageData>  $messages
     * @param  array<string, mixed>  $metadata
     */
    public function __construct(
        public string $tenantId,
        public AiTaskType $taskType,
        public array $messages,
        public ?string $userId = null,
        public ?string $model = null,
        public ?float $temperature = null,
        public ?int $maxTokens = null,
        public array $metadata = [],
    ) {
        if ($messages === []) {
            throw new \InvalidArgumentException('A requisição de IA deve conter ao menos uma mensagem.');
        }
    }
}
