<?php

namespace Modules\MedNotify\Services\Channels;

/**
 * Contract every MedNotify delivery adapter implements.
 *
 * Adapters are fail-soft by construction: send() NEVER throws. It returns a
 * status string ('sent' | 'failed' | 'skipped' | 'queued') which the service
 * records in mednotify_log along with any error captured internally.
 */
interface ChannelContract
{
    /**
     * Deliver one rendered message to one recipient.
     *
     * @param array $message   ['subject' => ?string, 'body' => string]
     * @param array $recipient ['type' => 'user'|'contact', 'id' => int,
     *                          'name' => string, 'email' => ?string,
     *                          'mobile' => ?string, 'model' => object|null]
     * @param array $context   ['business_id' => int, 'event_key' => string,
     *                          'business' => App\Business|null, 'variables' => array]
     *
     * @return array ['status' => string, 'error' => ?string]
     */
    public function send(array $message, array $recipient, array $context): array;
}
