<?php

namespace App\Enum\Contact;

enum MessageOrigin: string
{
    case MANUAL = 'manual';
    case STATUS_CHANGED = 'status_changed';
    case TAG_ADDED = 'tag_added';
    case TAG_REMOVED = 'tag_removed';
    case MODEL_CREATED = 'model_created';
    case MODEL_UPDATED = 'model_updated';
    case SCHEDULED = 'scheduled';
    case ESIGN_DOCUMENT_SENT = 'esign_document_sent';
    case API = 'api';
    case REPLAY = 'replay';

    public function label(): string
    {
        return match ($this) {
            self::MANUAL => 'Manual',
            self::STATUS_CHANGED => 'Status changed',
            self::TAG_ADDED => 'Tag added',
            self::TAG_REMOVED => 'Tag removed',
            self::MODEL_CREATED => 'Record created',
            self::MODEL_UPDATED => 'Record updated',
            self::SCHEDULED => 'Scheduled',
            self::ESIGN_DOCUMENT_SENT => 'E-signature document sent',
            self::API => 'API',
            self::REPLAY => 'Replay',
        };
    }

    public function isAutomatic(): bool
    {
        return $this !== self::MANUAL && $this !== self::API;
    }
}
