<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

/**
 * @property int $id
 * @property int $group_id
 * @property string $first_name
 * @property string $last_name
 * @property date $birthdate
 * @property string $image
 * @property string $local_passport
 * @property string $international_passport
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class Pilgrim extends Model
{
    use HasFactory;

    protected $fillable = [
        'group_id',
        'first_name',
        'last_name',
        'birthdate',
        'image',
        'local_passport',
        'international_passport',
    ];

    protected $casts = [
        'birthdate' => 'date',
    ];

    public function group(): BelongsTo
    {
        return $this->belongsTo(Group::class);
    }

    public function documents(): HasMany
    {
        return $this->hasMany(Document::class);
    }
}
