<?php

declare(strict_types=1);

namespace App\Models\Market;

use App\Models\Model;

class CartItem extends Model
{
    protected ?string $table = 'cart_items';

    protected array $fillable = [
        'hashkey',
        'cart_id',
        'product_id',
        'quantity',
        'price',
        'is_active',
        'created_by',
        'updated_by',
    ];

    protected array $casts = [
        'is_active' => 'boolean',
        'quantity' => 'integer',
        'price' => 'float',
    ];

    public function cart()
    {
        return $this->belongsTo(Cart::class, 'cart_id');
    }

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