<?php

namespace App\Enum\Esign;

/**
 * Marks a per-solicitor Contract as one of the Scotland's Redress Scheme
 * supplementary ("annex") documents. A contract with no role is an ordinary
 * one-document-per-send contract; an annex contract fans out into one document
 * per care setting when bundled into a signing request.
 *
 * These are ROLES, not template ids: each firm maps the role to its own
 * Fintrixor template (on its own account), so nothing here is hard-coded to a
 * single account. See EsignService::createDraftRequest().
 */
enum RedressRole: string
{
    /** Part 1 "Additional Care Settings" — one annex per care setting BEYOND the base 4. */
    case PART1_ANNEX = 'part1_annex';

    /** Part 2 "Additional Statement Pages" — one annex per care setting (every setting). */
    case PART2_ANNEX = 'part2_annex';

    public function label(): string
    {
        return match ($this) {
            self::PART1_ANNEX => 'Additional Care Settings (Part 1)',
            self::PART2_ANNEX => 'Additional Statement Pages (Part 2)',
        };
    }

    /** Which application part this annex belongs to. */
    public function part(): int
    {
        return match ($this) {
            self::PART1_ANNEX => 1,
            self::PART2_ANNEX => 2,
        };
    }
}
