<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Spatie\DiscordAlerts\Facades\DiscordAlert;

class DiscordReleaseNotification implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $slug;

    private $messageType;

    /**
     * Create a new job instance.
     */
    public function __construct($slug, $messageType)
    {
        $this->slug = $slug;
        $this->messageType = $messageType;
    }

    /**
     * Execute the job.
     */
    public function handle(): void
    {
        switch ($this->messageType) {
            case 'release':
                DiscordAlert::message('<@&868457842250764289> (´• ω •`)ﾉ New **4k** Release! Check it out here: https://hstream.moe/hentai/'.$this->slug);
                break;
            case 'release-censored':
                // Because Discord TOS
                DiscordAlert::message('<@&868457842250764289> (´• ω •`)ﾉ New **4k** Release: '.$this->slug.' - *No link here because of* :pLoli:');
                break;
            case 'update':
                // 1080p 48fps added
                DiscordAlert::to('update')->message('<@&1283518462584426598> (´• ω •`)ﾉ Added **48fps** to Release! Check it out here: https://hstream.moe/hentai/'.$this->slug);
                break;
            case 'updateUHD':
                // 4k 48fps added
                DiscordAlert::to('update')->message('<@&1326860920902778963> (´• ω •`)ﾉ Added **48fps 4k** to Release! Check it out here: https://hstream.moe/hentai/'.$this->slug);
                break;
            case 'v2':
                // v2 re-release
                DiscordAlert::to('rerelease')->message('<@&1425505303075754035> (´• ω •`)ﾉ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/'.$this->slug);
                break;
            default:
                break;
        }
    }
}
