<?php

namespace Modules\User\Entities;
    
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Auth\Entities\User;

class Employment extends Model
{
    /** @use HasFactory<\Modules\User\Database\Factories\EmploymentFactory> */
    use HasUuids;

    protected $table = 'employments';

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $fillable = [
        'user_id',
        'company_name',
        'job_title',
        'employment_type',
        'salary',
        'start_date',
        'end_date',
        'is_current',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var list<string>
     */
    protected $hidden = [
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'company_name' => 'string',
            'job_title' => 'string',
            'employment_type' => 'string',
            'salary' => 'decimal:2',
            'start_date' => 'date',
            'end_date' => 'date',
            'is_current' => 'boolean',
        ];
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
