<?php

namespace App\Models;

class HotelServiceModel extends TenantModel
{
    protected $table            = 'hotel_services';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'object';
    protected $useTimestamps    = true;

    protected $allowedFields = [
        'name',
        'description',
        'category',
        'price',
        'unit_label',
        'is_active',
    ];

    protected $validationRules = [
        'name'  => 'required|max_length[150]',
        'price' => 'required|decimal',
    ];

    public function active(): array
    {
        return $this->where('is_active', 1)->orderBy('category')->orderBy('name')->findAll();
    }
}
