<?php
namespace App\Http\Resources\Candidat;

use Illuminate\Http\Resources\Json\JsonResource;

class ParrainResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id'                    => $this->id,
            'nom_complet'           => $this->nom_complet,
            'lien_avec_candidat'    => $this->lien_avec_candidat,
            'telephone_principal'   => $this->telephone_principal,
            'telephone_secondaire'  => $this->telephone_secondaire,
            'email'                 => $this->email,
            'quartier'              => $this->quartier ? ['id' => $this->quartier->id, 'nom' => $this->quartier->nom] : null,
            'adresse_domicile'      => $this->adresse_domicile,
            'a_signe_contrat'       => $this->a_signe_contrat,
            'contrat_signe_at'      => $this->contrat_signe_at?->toISOString(),
            'created_at'            => $this->created_at->toISOString(),
        ];
    }
}
