<?php

use App\Models\User;

if (! function_exists('user_is_master_admin')) {

    function user_is_master_admin(?User $user)
    {

        if (is_null($user)) {
            return false;
        }

        $emails = ['autopilotshorts@gmail.com', 'team@autopilotshorts.com', 'charles@exastellar.com', 'charlesteh90@gmail.com'];
        $user_id = 0;

        if ($user->id == $user_id) {
            return true;
        } elseif (in_array($user->email, $emails)) {
            return true;
        }

        return false;
    }
}

if (! function_exists('user_is_blocked_from_purchase')) {

    function user_is_blocked_from_purchase(User $user)
    {
        $emails = ['productionlittlebird@gmail.com'];

        if (in_array($user->email, $emails)) {
            return true;
        }

        return false;
    }
}

if (! function_exists('user_can_generate_demo_videos')) {

    function user_can_generate_demo_videos(User $user)
    {
        return user_is_master_admin($user);
    }
}

if (! function_exists('user_is_external_reviewer')) {

    function user_is_external_reviewer(User $user)
    {
        $emails = [
            'shaebaelish.623259@gmail.com',
        ];

        if (in_array($user->email, $emails)) {
            return true;
        }

        return false;
    }
}
