<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class OfferFinanceFieldConfigView extends JsonResource
{
    public static $wrap = '';

    /**
     * @return array<string, mixed>
     */
    #[\Override]
    public function toArray(Request $request): array
    {
        return [
            'config' => [
                'id' => $this->resource->id,
                'key' => $this->resource->key,
                'label' => $this->resource->label,
                'type' => $this->resource->type,
                'suffix' => $this->resource->suffix,
                'position' => $this->resource->position,
            ],
            'types' => OfferFinanceFieldConfigList::types(),
        ];
    }
}
