<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\Pivot;

class SalesPhaseProduct extends Pivot
{
    use HasUuids, HasFactory;

    protected $table = 'sales_phase_products';

    protected $guarded = [];

    protected $casts = [
        'sale_price' => 'decimal:2',
        'land_value' => 'decimal:2',
        'foundation_value' => 'decimal:2',
        'discount_details' => 'array',
    ];

    public function salesPhase()
    {
        return $this->belongsTo(SalesPhase::class);
    }

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