<?php
/**
 * BookiFlex Cart Extension
 *
 * @package    BookiFlex
 * @subpackage Cart
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */


declare(strict_types=1);
namespace BookiFlex\Extensions\Cart\Contract;

use Vaened\PriceEngine\Summary;

defined( 'ABSPATH' ) || exit;

interface CartItemInterface
{
    /**
     * Get unique identifier for the item type (e.g., 'accommodation', 'service', 'transfer')
     */
    public function getType(): string;

    /**
     * Get unique hash to identify duplicate items in cart
     */
    public function getHash(): string;

    /**
     * Get display name for the item
     */
    public function getName(): string;

    /**
     * Calculate total price for this item
     */
    public function calculateUnitPrice(): int;

    /**
     * Get summary for financial calculations
     */
    public function getSummary(): array;

    /**
     * Validate if item is still valid (availability, dates, etc.)
     */
    public function validate(): bool;

    /**
     * Get validation errors if any
     */
    public function getValidationErrors(): array;

    /**
     * Convert to array for storage
     */
    public function toArray(): array;

    /**
     * Create from array (for restoration from DB)
     */
    public static function fromArray(array $data): self;

//    /**
//     * Check if this item can be merged with another
//     */
//    public function canMergeWith(CartItemInterface $item): bool;
//
//    /**
//     * Merge quantities with another item
//     */
//    public function mergeWith(CartItemInterface $item): void;
}
