<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RemoteOrderDetail extends Model
{
    protected $connection = 'tienda_remota';

    protected $table = 'order_detail';

    protected $primaryKey = 'id_order_detail';

    public $incrementing = true;

    protected $keyType = 'int';

    public $timestamps = false;

    protected $guarded = [];

    protected function casts(): array
    {
        return [
            'original_price' => 'decimal:6',
            'price_byGroup' => 'decimal:6',
            'product_quantity' => 'integer',
            'product_tax' => 'decimal:2',
            'tax_amount' => 'decimal:6',
            'discount_percent' => 'decimal:2',
            'discount_amount' => 'decimal:6',
            'product_priceTI' => 'decimal:6',
            'product_priceTE' => 'decimal:6',
            'total_priceTI' => 'decimal:6',
            'total_priceTE' => 'decimal:6',
        ];
    }

    public function save(array $options = []): bool
    {
        throw new \LogicException('RemoteOrderDetail es de solo lectura (tienda_remota).');
    }

    public function delete(): bool
    {
        throw new \LogicException('RemoteOrderDetail es de solo lectura (tienda_remota).');
    }
}
