<?php

namespace App\Download;

enum DownloadEvents
{
    case DOWNLOAD_ADDED;
    case DOWNLOAD_STARTED;
    case DOWNLOAD_FINISHED;
    case DOWNLOAD_DELETED;
    case DOWNLOAD_ERROR;

    public function type(): string
    {
        return match ($this) {
            self::DOWNLOAD_ADDED => 'download_added',
            self::DOWNLOAD_STARTED => 'download_started',
            self::DOWNLOAD_FINISHED => 'download_finished',
            self::DOWNLOAD_DELETED => 'download_deleted',
            self::DOWNLOAD_ERROR => 'download_error',
        };
    }

    public function message(): string
    {
        return match ($this) {
            self::DOWNLOAD_ADDED => 'A new download has been added.',
            self::DOWNLOAD_STARTED => 'A download has started.',
            self::DOWNLOAD_FINISHED => 'A download has finished.',
            self::DOWNLOAD_DELETED => 'A download has been deleted.',
            self::DOWNLOAD_ERROR => 'A download has encountered an error.',
        };
    }
}
