<?php

namespace Modules\MembershipApplication\Entities;

use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class MembershipApplicationApplicant extends Model
{
    use HasUuids;

    protected $table = 'membership_application_applicants';

    /**
     * @var list<string>
     */
    protected $fillable = [
        'membership_application_id',
        'name',
        'email',
        'ic_number',
        'birth_date',
        'birth_place',
        'gender',
        'marriage_status',
        'address',
        'phone_number',
        'office_number',
        'postcode',
        'employer_name',
        'employer_address',
        'current_position',
        'start_work_date',
        'stock_monthly_contribution',
        'fee_monthly_contribution',
    ];

    /**
     * @var list<string>
     */
    protected $hidden = [
    ];

    protected function casts(): array
    {
        return [
            'start_work_date' => 'date',
            'stock_monthly_contribution' => 'decimal:2',
            'fee_monthly_contribution' => 'decimal:2',
        ];
    }

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