<?php

namespace App\Mail;

use App\Models\Association;
use App\Models\Election;
use Illuminate\Mail\Mailables\Content;

class VotingReminderMail extends BaseGuildMail
{
    public function __construct(
        public Election $election,
        public Association $association,
        public string $reminderType = '24h', // '24h' or '1h'
    ) {
        $this->withAssociation($association);
    }

    protected function getSubject(): string
    {
        $urgency = $this->reminderType === '1h' ? '[URGENT] ' : '';
        $timeLeft = $this->reminderType === '1h' ? '1 Hour' : '24 Hours';
        return "{$urgency}Voting Closes in {$timeLeft}: {$this->election->title}";
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.election.voting-reminder',
        );
    }
}
