<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AddOn extends Model
{
    protected $fillable = [
        'name',
        'description',
        'price_type',
        'price',
        'is_bundle',
        'active',
        'sort_order',
        'badge'
    ];

    protected $casts = [
        'is_bundle' => 'boolean',
        'active' => 'boolean',
        'price' => 'decimal:2',
    ];

    public function cars()
    {
        return $this->belongsToMany(Car::class, 'car_add_ons')
            ->withPivot('custom_price', 'is_suggested_bundle')
            ->withTimestamps();
    }
}
