<?php

namespace App\Models;

use App\Models\Concerns\BelongsToCompany;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Appreciation extends Model
{
    use BelongsToCompany;

    protected $table = 'appreciations';

    protected $fillable = ['company_id', 'user_id', 'title', 'description', 'appreciation_date', 'date', 'given_by'];

    protected $casts = [
        'appreciation_date' => 'date',
        'date' => 'datetime',
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    public function givenByUser(): BelongsTo
    {
        return $this->belongsTo(User::class, 'given_by');
    }
}
