<?php

namespace Modules\Bms\Services\Contracts;

use Modules\Bms\Entities\BmsBooking;

/**
 * Invoicing boundary — reuses the ERP's invoicing/receivables. A confirmed
 * booking produces an ERP invoice (transaction) linked back to the booking.
 * Implemented against the ERP core in Milestone 7.
 */
interface InvoiceServiceContract
{
    /**
     * Create (or update) the ERP invoice for a booking.
     *
     * @return int|null  ERP transaction id
     */
    public function createOrUpdateFromBooking(BmsBooking $booking): ?int;

    /**
     * Current invoice + payment status for a booking's linked invoice.
     *
     * @return array  ['total' => ..., 'paid' => ..., 'due' => ..., 'status' => ...]
     */
    public function statusForBooking(BmsBooking $booking): array;

    /**
     * Adjust the linked invoice total (e.g. reduce to a retained cancellation
     * penalty, or add a reschedule fee) and refresh its payment status.
     *
     * @return int|null  ERP transaction id (null when there is no invoice)
     */
    public function adjustInvoiceTotal(BmsBooking $booking, float $newTotal, ?string $note = null): ?int;
}
