<?php

namespace App\Enum\Contact;

enum MessageEventType: string
{
    case QUEUED = 'queued';
    case SENDING = 'sending';
    case SENT = 'sent';
    case PROCESSED = 'processed';
    case DELIVERED = 'delivered';
    case OPEN = 'open';
    case CLICK = 'click';
    case BOUNCE = 'bounce';
    case DROPPED = 'dropped';
    case DEFERRED = 'deferred';
    case SPAM_REPORT = 'spam_report';
    case UNDELIVERED = 'undelivered';
    case FAILED = 'failed';
    case SUPPRESSED = 'suppressed';
    case RECEIVED = 'received';
    case REPLY = 'reply';
    case OPT_OUT = 'opt_out';
    case UNKNOWN = 'unknown';

    public function label(): string
    {
        return ucwords(str_replace('_', ' ', $this->value));
    }

    public function color(): string
    {
        return match ($this) {
            self::QUEUED, self::SENDING, self::PROCESSED => 'info',
            self::SENT, self::DELIVERED, self::OPEN, self::CLICK => 'success',
            self::DEFERRED => 'warning',
            self::BOUNCE, self::DROPPED, self::SPAM_REPORT,
            self::UNDELIVERED, self::FAILED, self::SUPPRESSED => 'danger',
            self::RECEIVED, self::REPLY => 'primary',
            self::OPT_OUT => 'dark',
            self::UNKNOWN => 'secondary',
        };
    }
}
