<?php
namespace App\Helper;
use Illuminate\Support\Facades\Mail;

class Helper{
    public const MAIL_TO_SEND = "josue181094@gmail.com";
    /**
     * 
     */
    public static function getEspeciality($code){
        $especiality = "";
        switch ($code) {
            case 'PED':
                $especiality = "Pediatría";
            break;
            case 'NED':
                $especiality = "Nefrología";
            break;
        }
        return $especiality;
    }

    public static function getParent($code){
        $parent = "";
        switch ($code) {
            case "FATH":
               $parent = "Padre";
            break;
            case "MOTH":
                $parent = "Madre";
            break;
            case "UNCL":
                $parent = "Tío";
            break;
            case "AUNT":
                $parent = "Tía";
            break;
            case "GRAF":
                $parent = "Abuelo";
            break;
            case "GRAM":
                $parent = "Abuela";
            break;
            case "BROT":
                $parent = "Hermano";
            break;
            case "SIST":
                $parent = "Hermana";
            break;
            case "OTHE":
                $parent = "Otro";
            break;
        }
        return $parent;
    }


    /**
     * 
     */
    public static function JsonToCollection($json){
        $collection = collect(json_decode($json, true));
        return $collection;
    }

    /**
     * 
     */
    public static function sendEmail($from,$emails,$subject,$data,$classImpl){
         Mail::to($emails)->send(new $classImpl($from,$subject,$data));
         return Mail::failures();
    }

 
}