<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Service extends Model
{
    protected $fillable = ['branch_id', 'service_category_id', 'name', 'description', 'duration_minutes', 'buffer_minutes', 'price', 'deposit_amount', 'image_path', 'online_bookable', 'addons'];
    protected $casts = ['addons' => 'array', 'online_bookable' => 'boolean', 'price' => 'decimal:2', 'deposit_amount' => 'decimal:2'];

    public function category()
    {
        return $this->belongsTo(ServiceCategory::class, 'service_category_id');
    }

    public function branch()
    {
        return $this->belongsTo(Branch::class);
    }

    public function bookings()
    {
        return $this->hasMany(Booking::class);
    }
}
