<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Answer extends Model
{
    use HasFactory;

    public const UPDATED_AT = null;

    protected $fillable = [
        'question_id',
        'branch_id',
        'office_id',
        'user_id',
        'answer_value',
        'notes',
    ];

    /**
     * @return BelongsTo<Question, Answer>
     */
    public function question(): BelongsTo
    {
        return $this->belongsTo(Question::class);
    }

    /**
     * @return BelongsTo<User, Answer>
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    /**
     * @return BelongsTo<OrganizationalUnit, Answer>
     */
    public function branch(): BelongsTo
    {
        return $this->belongsTo(OrganizationalUnit::class, 'branch_id');
    }

    /**
     * @return BelongsTo<OrganizationalUnit, Answer>
     */
    public function office(): BelongsTo
    {
        return $this->belongsTo(OrganizationalUnit::class, 'office_id');
    }
}
