<?php

namespace App\Http\Resources;

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

class ProfesseurResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    { 

        return [
            'id' => $this->id,
            'nomar' => $this->nomar,
            'nomfr' => $this->nomfr,
            'matricule' => $this->matricule,
            'nni' => $this->nni,
            'date_naissance' => $this->date_naissance,
            'lieu_naissance_ar' => $this->lieu_naissance_ar,
            'lieu_naissance_fr' => $this->lieu_naissance_fr,
            'discipline_origine' => $this->discipline_origine,
            'contact' => $this->contact,
            'photo' => $this->photo,
            'date_recritement' => $this->date_recritement,
            'cycle' => [
                'id' => $this->cycle->id ?? null,
                'libelle' => $this->cycle->libelle ?? null,
            ],
            'statut' => [
                'id' => $this->statut->id ?? null,
                'libelle' => $this->statut->libelle ?? null,
            ],
            'created_at' => $this->created_at,
        ];
    }
}
