<?php

namespace App\Modules\HR\Employees\Models;

use App\Modules\Platform\Geography\Models\GeoCity;
use App\Modules\Platform\Geography\Models\GeoCountry;
use App\Modules\Platform\Geography\Models\GeoRegion;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class EmployeeAddress extends Model
{
    protected $fillable = [
        'employee_id',
        'country_id',
        'region_id',
        'city_id',
        'country',
        'state',
        'city',
        'street',
        'building_number',
        'location_link',
    ];

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

    public function country(): BelongsTo
    {
        return $this->belongsTo(GeoCountry::class, 'country_id');
    }

    public function region(): BelongsTo
    {
        return $this->belongsTo(GeoRegion::class, 'region_id');
    }

    public function city(): BelongsTo
    {
        return $this->belongsTo(GeoCity::class, 'city_id');
    }
}
