<?php

declare(strict_types=1);

namespace KimaAI\Ai\Providers\DTO;

final class EmbeddingRequest {
  public function __construct(
    public string $model,
    public string|array $input,
    public array $provider_options = []
  ) {
  }

  public static function fromArray(array $payload): self {
    return new self(
      (string) ($payload['model'] ?? ''),
      $payload['input'] ?? '',
      $payload
    );
  }

  public function toArray(): array {
    $payload = $this->provider_options;
    $payload['model'] = $this->model;
    $payload['input'] = $this->input;
    return $payload;
  }
}
