<?php

namespace App\Http\Resources\Auth;

use Illuminate\Http\Resources\Json\JsonResource;

class RegisterResource extends JsonResource
{
    public function toArray($request): array
    {
        $user = $this->resource['user'] ?? null;

        return [
            'user_id' => $user?->id,
            'email' => $user?->email,
            'firstname' => $user?->firstname,
            'lastname' => $user?->lastname,
            'role' => $this->resource['role'] ?? null,
            'activation_sent' => (bool) ($this->resource['activation_sent'] ?? false),
        ];
    }
}
