<?php

namespace App\Console\Commands;

use App\Mail\WelcomeEmail;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Models\User;

class SendParentVerificationEmail extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'send:parent_verification_email {--uri=} {--uri2=} {--uri3=} {--uri4=} {--uri5=} {--user_id=}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send Parent Verification Email';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $subject = urldecode($this->option("uri"));
        $to = urldecode($this->option("uri2"));
        $name = urldecode($this->option("uri3"));
        $token = urldecode($this->option("uri4"));
        $parent_name = urldecode($this->option("uri5"));
        $user_id = $this->option("user_id");
        $user = User::find($user_id);
        //$mailbody = view('email_templates.parent_approval', compact('name','token','parent_name'))->render();
        //send_email($to, $subject, $mailbody);
        $url = route('parent.approval.link', ['token' => $token]);
        //$sms_content = "We hope this message finds you well. Your daughter, ".$user->name.", has expressed interest in registering on our matrimonial platform. As part of our commitment to ensuring a safe and respectful environment, we kindly request your approval for her registration by cliking the following link: $url If you have any questions or concerns, feel free to reach out to us.";
        $sms_content =
            "
            نأمل أن تكونوا بخير. لقد أبدت ابنتكم، {$user->name}، رغبتها في التسجيل على منصتنا الخاصة بالزواج.
            وحرصًا منا على توفير بيئة آمنة ومحترمة، نرجو منكم التكرم بالموافقة على تسجيلها من خلال الضغط على الرابط التالي:
            {$url}

            في حال كانت لديكم أي استفسارات أو ملاحظات، لا تترددوا في التواصل معنا.";
        $d = send_normal_SMS($sms_content, $user->gardien_phone_dial_code . $user->gardien_phone_number);

        print_r($d);

    }
}
