<?php

namespace App\Repositories\Shop;

use App\Mail\Acheminement;
use App\Mail\ConfirmationCommande;
use App\Mail\Preparation;
use Illuminate\Support\Facades\Mail;

class OrderMails
{
    public static function testSend($id)
    {
        self::sendPreparation($id);
    }

    public static function sendOrderConfirmed($orderId)
    {
        $order = Orders::get($orderId, ['customer', 'delivery_address']);
        $mail = new ConfirmationCommande($order);

        return Mail::to($order->customer->email)->send($mail);
    }

    public static function sendPreparation($orderId)
    {
        $order = Orders::get($orderId, ['customer', 'delivery_address']);
        $mail = new Preparation($order);

        return Mail::to($order->customer->email)->send($mail);
    }

    public static function sendShipping($orderId)
    {
        $order = Orders::get($orderId, ['customer', 'delivery_address']);
        $mail = new Acheminement($order);

        return Mail::to($order->customer->email)->send($mail);
    }
}
