<?php

namespace App\Models;

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

class LockerCategory extends Model
{
    use HasFactory;

    protected $fillable = [
        'name', 'code', 'base_price', 'description', 'display_order', 'is_active',
    ];

    protected $casts = [
        'base_price' => 'decimal:2',
        'is_active'  => 'boolean',
    ];

    public function lockers()
    {
        return $this->hasMany(Locker::class, 'category_id');
    }

    public function pricing()
    {
        return $this->hasMany(LockerPricing::class, 'category_id')->where('is_active', true)->orderBy('duration_days');
    }
}
