<?php
namespace Components\Models;

class CustomerBasket extends BaseModel
{
    protected static string $table = 'customers_basket';
    protected static string $primaryKey = 'customers_basket_id';

    public static function isReadOnly(): bool
    {
        return true;
    }

    public function customer(): ?Customer
    {
        $customer = $this->belongsTo(Customer::class, 'customers_id', 'customers_id');
        return $customer instanceof Customer ? $customer : null;
    }

    /**
     * @return array<int, CustomerBasketAttribute>
     */
    public function attributes(): array
    {
        return $this->hasMany(CustomerBasketAttribute::class, 'customers_id', 'customers_id');
    }
}
