<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Actual extends Model
{
    use HasFactory, HasUuids;

    protected $primaryKey = 'id';

    public $incrementing = false;

    protected $keyType = 'string';

    protected $table = 'actuals';

    protected $fillable = [
        'project_id',
        'team_member_id',
        'month',
        'hours_logged',
        'notes',
    ];

    protected $casts = [
        'month' => 'date',
        'hours_logged' => 'decimal:2',
    ];

    /**
     * Get the project that owns the actual.
     */
    public function project()
    {
        return $this->belongsTo(Project::class);
    }

    /**
     * Get the team member that owns the actual.
     */
    public function teamMember()
    {
        return $this->belongsTo(TeamMember::class);
    }
}
