<?php

namespace App\Models\Tenant;

use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class PayrollAdjustment extends Model
{
    use BelongsToTenant, SoftDeletes;

    public const TYPES = [
        'bonus' => 'Bonus',
        'fine' => 'Penalizare',
        'advance' => 'Avans',
    ];

    protected $fillable = [
        'company_id', 'user_id', 'type', 'amount',
        'period', 'date', 'reason', 'applied',
    ];

    protected $casts = [
        'amount' => 'decimal:2',
        'date' => 'date',
        'applied' => 'boolean',
    ];

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