<?php

namespace App\Domains\Event\Actions\ManualCertificateOfConductionCheck;

use App\Enumerations\EfzStatus;
use App\Mail\ParticipantCocMails\ParticipantCocCompleteMail;
use App\Mail\ParticipantCocMails\ParticipantCocInvalidMail;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail;

class ManualCertificateOfConductionCheckCommand {
    function __construct(public ManualCertificateOfConductionCheckRequest $request)
    {}

    public function execute() : ManualCertificateOfConductionCheckResponse {
        $response = new ManualCertificateOfConductionCheckResponse();


        $this->request->participant->efz_status = EfzStatus::EFZ_STATUS_CHECKED_VALID;
        $this->request->participant->save();
        $response->success = true;

        Mail::to($this->request->participant->email_1)->send(new ParticipantCocCompleteMail(
            participant: $this->request->participant,
        ));

        return $response;
    }
}
