<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CustomerViolation extends Model
{
    protected $fillable = [
        'customer_id',
        'rental_id',
        'violation_type',
        'description',
        'fine_amount',
        'status',
        'violation_date',
        'evidence',
        'notes',
        'reported_by',
        'reviewed_by',
    ];

    protected $casts = [
        'violation_date' => 'date',
        'fine_amount' => 'decimal:2',
    ];

    public function customer()
    {
        return $this->belongsTo(Customer::class);
    }

    public function rental()
    {
        return $this->belongsTo(\App\Models\Rental\Rental::class);
    }

    public function reportedBy()
    {
        return $this->belongsTo(\App\Models\User::class, 'reported_by');
    }

    public function reviewedBy()
    {
        return $this->belongsTo(\App\Models\User::class, 'reviewed_by');
    }
}
