<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CartItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'cart_id', 'item_type', 'api_pid', 'name', 'domain_name', 'tld', 'operation', 'billing_cycle', 'years',
        'quantity', 'currency', 'base_usd_price', 'unit_price', 'total', 'price_source', 'price_checked_at', 'metadata',
    ];

    protected $casts = [
        'metadata' => 'array',
        'price_checked_at' => 'datetime',
    ];

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