<?php

declare(strict_types=1);

namespace App\Http\Resources;

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

class SettingResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'key' => $this->key,
            'name' => $this->key,
            'slug' => $this->key,
            'value' => $this->value,
            'content' => $this->value,
            'text' => is_string($this->value) ? $this->value : null,
            'type' => $this->type,
            'is_public' => (bool) $this->is_public,
        ];
    }
}
