<?php

namespace App\Models;

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

class ReconProductMappingComponent extends Model
{
    protected $fillable = [
        'mapping_id',
        'product_id',
        'qty_multiplier',
    ];

    protected $casts = [
        'qty_multiplier' => 'decimal:2',
    ];

    public function mapping(): BelongsTo
    {
        return $this->belongsTo(ReconProductMapping::class, 'mapping_id');
    }

    public function product(): BelongsTo
    {
        return $this->belongsTo(Product::class);
    }
}
