<?php

namespace App\Http\Resources\Preferences;

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

class PreferencesListResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->resource->id ?? null,
            'user_id' => $this->resource->user_id ?? null,
            'firstname' => $this->resource->firstname ?? null,
            'lastname' => $this->resource->lastname ?? null,
            'email' => $this->resource->email ?? null,
            'receive_email_notifications' => (bool) ($this->resource->notification_email ?? false),
            'receive_sms_notifications' => (bool) ($this->resource->notification_sms ?? false),
            'theme' => $this->resource->theme ?? null,
            'language' => $this->resource->language ?? null,
            'style_color' => $this->resource->style_color ?? null,
            'menu_color' => $this->resource->menu_color ?? null,
            'created_at' => $this->resource->created_at ?? null,
            'updated_at' => $this->resource->updated_at ?? null,
        ];
    }
}
