<?php

declare(strict_types=1);

namespace App\Framework\Search;

/**
 * Represents a single sort field
 */
final readonly class SearchSortField
{
    public function __construct(
        public string $field,
        public SearchSortDirection $direction,
        public ?float $boost = null
    ) {
    }

    public function toArray(): array
    {
        return [
            'field' => $this->field,
            'direction' => $this->direction->value,
            'boost' => $this->boost,
        ];
    }
}
