<?php

namespace App\Mail\Communication;

use App\Models\Ticket;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class TicketStatusMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(
        public Ticket $ticket,
        public string $previousStatus
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Ticket Status Updated: {$this->ticket->unique_identifier}",
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.tickets.status-change',
            with: [
                'ticket' => $this->ticket,
                'previousStatus' => $this->previousStatus,
                'statusColors' => [
                    'pending' => '#f59e0b',
                    'in_progress' => '#3b82f6',
                    'resolved' => '#10b981',
                    'closed' => '#6b7280',
                ],
            ],
        );
    }
}
