<?php

declare(strict_types=1);

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum PaymentMethod: string implements HasColor, HasLabel
{
    /** Card or Apple Pay through a Revolut hosted checkout. Self-confirming. */
    case RevolutLink = 'revolut_link';

    /** Manual bank transfer, verified by a human against the statement. */
    case BankTransfer = 'bank_transfer';

    /** Money going back out. Recorded, never moved by this system. */
    case Refund = 'refund';

    /** No money involved — the booking was drawn from a package. */
    case Package = 'package';

    /** Whether settlement needs a person to look at it. */
    public function needsHumanVerification(): bool
    {
        return $this === self::BankTransfer;
    }

    public function getLabel(): string
    {
        return match ($this) {
            self::RevolutLink => 'Card or Apple Pay',
            self::BankTransfer => 'Bank transfer',
            self::Refund => 'Refund',
            self::Package => 'Package',
        };
    }

    public function getColor(): string
    {
        return match ($this) {
            self::RevolutLink => 'success',
            self::BankTransfer => 'warning',
            self::Refund => 'danger',
            self::Package => 'gray',
        };
    }
}
