<?php

namespace App\Models;

use App\Traits\Auditable;
use Illuminate\Database\Eloquent\Model;

class Ticket extends Model
{
    use Auditable;

    protected $fillable = [
        'ticket_no',
        'ticket_type_id',
        'customer_id',
        'title',
        'description',
        'priority',
        'status',
        'created_by',
        'assigned_at',
        'approved_by',
        'approved_at',
        'rejected_by',
        'rejected_at',
        'rejection_reason',
        'resolved_at',
        'closed_at',
    ];

    /*
    |--------------------------------------------------------------------------
    | Relationships
    |--------------------------------------------------------------------------
    */

    public function ticketType()
    {
        return $this->belongsTo(
            TicketType::class,
            'ticket_type_id'
        );
    }
}
