<?php

namespace Modules\Vrc\Entities;

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

/**
 * A repair labor operation (spec §5.1). Carries default labor hours, price and
 * a taxable flag (with an optional ERP tax_rate id) so it can prefill a
 * repair-order / estimate line.
 */
class VrcService extends Model
{
    protected $table = 'vrc_services';

    protected $fillable = [
        'business_id', 'category_id', 'code', 'hsn_sac', 'name', 'name_ar', 'description',
        'default_labor_hours', 'default_price', 'taxable', 'tax_rate_id', 'is_active',
    ];

    protected $casts = [
        'default_labor_hours' => 'decimal:2',
        'default_price'       => 'decimal:2',
        'taxable'             => 'boolean',
        'is_active'           => 'boolean',
    ];

    public function category(): BelongsTo
    {
        return $this->belongsTo(VrcServiceCategory::class, 'category_id');
    }
}
