<?php
defined('ABSPATH') or die();
function aiomatic_return_god_function_assistants($god_mode, $ai, $lead, $dalle, $stable, $midjourney, $replicate, $ideogram, $amazon, $amazon_details, $scraper, $rss, $google, $captions, $royalty, $youtube, $email, $facebook, $facebook_image, $twitter, $threads, $instagram, $pinterest, $business, $youtube_community, $reddit, $linkedin, $webhook, $stable_video, $database, $chart, $toubiz, $google_image, $end, $omniblock, $booking, $clickbank, $cloudflare)
{
    $return_arr = array();
    if ($god_mode === true)
    {
        $return_arr[] = aiomatic_get_god_mode_object();
    }
    if ($chart === true)
    {
        $return_arr[] = aiomatic_get_chart_object();
    }
    if ($dalle === true)
    {
        $return_arr[] = aiomatic_get_dalle_object();
    }
    if ($stable === true)
    {
        $return_arr[] = aiomatic_get_stable_object();
    }
    if ($google_image === true)
    {
        $return_arr[] = aiomatic_get_google_image_object();
    }
    if ($midjourney === true)
    {
        $return_arr[] = aiomatic_get_midjourney_object();
    }
    if ($replicate === true)
    {
        $return_arr[] = aiomatic_get_replicate_object();
    }
    if ($ideogram === true)
    {
        $return_arr[] = aiomatic_get_ideogram_object();
    }
    if ($cloudflare === true)
    {
        $return_arr[] = aiomatic_get_cloudflare_object();
    }
    if ($stable_video === true)
    {
        $return_arr[] = aiomatic_get_stable_video_object();
    }
    if ($amazon === true)
    {
        $return_arr[] = aiomatic_get_amazon_object();
    }
    if ($clickbank === true)
    {
        $return_arr[] = aiomatic_get_clickbank_object();
    }
    if ($amazon_details === true)
    {
        $return_arr[] = aiomatic_get_amazon_details_object();
    }
    if ($booking === true)
    {
        $return_arr[] = aiomatic_get_booking_object();
    }
    if ($scraper === true)
    {
        $return_arr[] = aiomatic_get_scraper_object();
    }
    if ($rss === true)
    {
        $return_arr[] = aiomatic_get_rss_object();
    }
    if ($google === true)
    {
        $return_arr[] = aiomatic_get_google_object();
    }
    if ($captions === true)
    {
        $return_arr[] = aiomatic_get_youtube_captions_object();
    }
    if ($email === true)
    {
        $return_arr[] = aiomatic_get_email_object();
    }
    if ($webhook === true)
    {
        $return_arr[] = aiomatic_get_webhook_object();
    }
    if ($youtube === true)
    {
        $return_arr[] = aiomatic_get_youtube_object();
    }
    if ($royalty === true)
    {
        $return_arr[] = aiomatic_get_royalty_object();
    }
    if ($lead === true)
    {
        $return_arr[] = aiomatic_get_lead_capture_object();
    }
    if ($ai === true)
    {
        $return_arr[] = aiomatic_get_ai_object();
    }
    if ($database === true)
    {
        $return_arr[] = aiomatic_get_database_object();
    }
    if ($toubiz === true)
    {
        $return_arr[] = aiomatic_get_toubiz_object();
    }
    if ($omniblock === true)
    {
        $return_arr[] = aiomatic_get_omniblock_object();
    }
    if ($facebook === true)
    {
        $return_arr[] = aiomatic_get_facebook_object();
    }
    if ($facebook_image === true)
    {
        $return_arr[] = aiomatic_get_facebook_image_object();
    }
    if ($twitter === true)
    {
        $return_arr[] = aiomatic_get_twitter_object();
    }
    if ($threads === true)
    {
        $return_arr[] = aiomatic_get_threads_object();
    }
    if ($instagram === true)
    {
        $return_arr[] = aiomatic_get_instagram_object();
    }
    if ($pinterest === true)
    {
        $return_arr[] = aiomatic_get_pinterest_object();
    }
    if ($business === true)
    {
        $return_arr[] = aiomatic_get_google_business_object();
    }
    if ($youtube_community === true)
    {
        $return_arr[] = aiomatic_get_youtube_community_object();
    }
    if ($reddit === true)
    {
        $return_arr[] = aiomatic_get_reddit_object();
    }
    if ($linkedin === true)
    {
        $return_arr[] = aiomatic_get_linkedin_object();
    }
    if ($end === true)
    {
        $return_arr[] = aiomatic_get_end_object();
    }
    return $return_arr;
}
function aiomatic_return_god_function_realtime($god_mode, $ai, $lead, $dalle, $stable, $midjourney, $replicate, $ideogram, $amazon, $amazon_details, $scraper, $rss, $google, $captions, $royalty, $youtube, $email, $facebook, $facebook_image, $twitter, $threads, $instagram, $pinterest, $business, $youtube_community, $reddit, $linkedin, $webhook, $stable_video, $database, $chart, $toubiz, $google_image, $end, $omniblock, $booking, $clickbank, $cloudflare)
{
    $return_arr = array();
    if ($god_mode === true)
    {
        $return_arr[] = aiomatic_get_god_mode_object(true);
    }
    if ($chart === true)
    {
        $return_arr[] = aiomatic_get_chart_object(true);
    }
    if ($dalle === true)
    {
        $return_arr[] = aiomatic_get_dalle_object(true);
    }
    if ($stable === true)
    {
        $return_arr[] = aiomatic_get_stable_object(true);
    }
    if ($google_image === true)
    {
        $return_arr[] = aiomatic_get_google_image_object(true);
    }
    if ($omniblock === true)
    {
        $return_arr[] = aiomatic_get_omniblock_object(true);
    }
    if ($midjourney === true)
    {
        $return_arr[] = aiomatic_get_midjourney_object(true);
    }
    if ($replicate === true)
    {
        $return_arr[] = aiomatic_get_replicate_object(true);
    }
    if ($ideogram === true)
    {
        $return_arr[] = aiomatic_get_ideogram_object(true);
    }
    if ($cloudflare === true)
    {
        $return_arr[] = aiomatic_get_cloudflare_object(true);
    }
    if ($stable_video === true)
    {
        $return_arr[] = aiomatic_get_stable_video_object(true);
    }
    if ($amazon === true)
    {
        $return_arr[] = aiomatic_get_amazon_object(true);
    }
    if ($clickbank === true)
    {
        $return_arr[] = aiomatic_get_clickbank_object(true);
    }
    if ($amazon_details === true)
    {
        $return_arr[] = aiomatic_get_amazon_details_object(true);
    }
    if ($booking === true)
    {
        $return_arr[] = aiomatic_get_booking_object(true);
    }
    if ($scraper === true)
    {
        $return_arr[] = aiomatic_get_scraper_object(true);
    }
    if ($rss === true)
    {
        $return_arr[] = aiomatic_get_rss_object(true);
    }
    if ($google === true)
    {
        $return_arr[] = aiomatic_get_google_object(true);
    }
    if ($captions === true)
    {
        $return_arr[] = aiomatic_get_youtube_captions_object(true);
    }
    if ($email === true)
    {
        $return_arr[] = aiomatic_get_email_object(true);
    }
    if ($webhook === true)
    {
        $return_arr[] = aiomatic_get_webhook_object(true);
    }
    if ($youtube === true)
    {
        $return_arr[] = aiomatic_get_youtube_object(true);
    }
    if ($royalty === true)
    {
        $return_arr[] = aiomatic_get_royalty_object(true);
    }
    if ($lead === true)
    {
        $return_arr[] = aiomatic_get_lead_capture_object(true);
    }
    if ($ai === true)
    {
        $return_arr[] = aiomatic_get_ai_object(true);
    }
    if ($database === true)
    {
        $return_arr[] = aiomatic_get_database_object(true);
    }
    if ($toubiz === true)
    {
        $return_arr[] = aiomatic_get_toubiz_object(true);
    }
    if ($facebook === true)
    {
        $return_arr[] = aiomatic_get_facebook_object(true);
    }
    if ($facebook_image === true)
    {
        $return_arr[] = aiomatic_get_facebook_image_object(true);
    }
    if ($twitter === true)
    {
        $return_arr[] = aiomatic_get_twitter_object(true);
    }
    if ($threads === true)
    {
        $return_arr[] = aiomatic_get_threads_object(true);
    }
    if ($instagram === true)
    {
        $return_arr[] = aiomatic_get_instagram_object(true);
    }
    if ($pinterest === true)
    {
        $return_arr[] = aiomatic_get_pinterest_object(true);
    }
    if ($business === true)
    {
        $return_arr[] = aiomatic_get_google_business_object(true);
    }
    if ($youtube_community === true)
    {
        $return_arr[] = aiomatic_get_youtube_community_object(true);
    }
    if ($reddit === true)
    {
        $return_arr[] = aiomatic_get_reddit_object(true);
    }
    if ($linkedin === true)
    {
        $return_arr[] = aiomatic_get_linkedin_object(true);
    }
    if ($end === true)
    {
        $return_arr[] = aiomatic_get_end_object(true);
    }
    return $return_arr;
}
function aiomatic_get_god_mode_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'aimogen_wp_god_mode',
        'Call any WordPress function using this wrapper function. Add the WP function name which needs to be called in the first parameter, and the parameters which needs to be sent to the function, in an array, sent as the second parameter for the wrapper function. Parameters will be processed using call_user_func_array, use parameters accordingly.',
        [
            new Aiomatic_Query_Parameter('called_function_name', 'The name of the WP function which needs to be called.', 'string', true),
            new Aiomatic_Query_Parameter('parameter_array', 'An array of parameters which should be sent to the function. Return parameters which can be parsed by call_user_func_array, as this is how the function will be called.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_dalle_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_openai',
        'Call OpenAI AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_chart_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_chart',
        'Generate and display charts dynamically using the [aiomatic_chat_charts] shortcode. Supports Bar, Line, and Pie charts, rendered as images for compatibility with WordPress posts, pages, and chatbot interfaces.
Usage:
[aiomatic_chat_charts type="bar/line/pie" title="ChartTitle" labels="Label1,Label2,Label3" data="Value1,Value2,Value3" colors="#RGB1,#RGB2,#RGB3"]
Example:
[aiomatic_chat_charts type="pie" title="Expense Distribution" labels="Rent,Utilities,Groceries" data="40,30,30" colors="#FF6384,#36A2EB,#FFCE56"]
This shortcode will generate a Pie chart titled "Expense Distribution" with segments for Rent, Utilities, and Groceries, having values 40, 30, and 30 respectively, using the specified colors.',
        [
            new Aiomatic_Query_Parameter('shortcode', 'The [aiomatic_chat_charts] shortcode used to generate the chart. Customize parameters such as type, title, labels, data, and colors.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_end_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'end_chatbot_conversation',
        'End conversation of the chatbot, if needed. The user will not be able to continue conversation afterwards.',
        [
            new Aiomatic_Query_Parameter('end', 'Set to 1 to end conversation', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_amazon_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'search_amazon',
        'Get an Amazon product listing based on a search keyword phrase.',
        [
            new Aiomatic_Query_Parameter('query', 'The keyword phrase for which the Amazon product listing should be returned.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_clickbank_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'search_clickbank',
        'Get an ClickBank product listing based on a search keyword phrase.',
        [
            new Aiomatic_Query_Parameter('query', 'The keyword phrase for which the ClickBank product listing should be returned.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_amazon_details_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'get_amazon_product_details',
        'Get details for a specific Amazon product, by ASIN or by keyword phrase.',
        [
            new Aiomatic_Query_Parameter('query', 'The ASIN or keyword phrase for which the Amazon product details should be returned.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_booking_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'manage_booking_calendar_booking',
        'Check availability and create a booking in Booking Calendar. Returns booking_id if created, or false if the slot is taken.',
        [
            new Aiomatic_Query_Parameter('start_date', 'Booking start date/time, e.g. "2027-08-24 15:00:00"', 'string', true),
            new Aiomatic_Query_Parameter('end_date', 'Booking end date/time, e.g. "2027-08-24 16:00:00"', 'string', true),
            new Aiomatic_Query_Parameter('name', 'Customer name', 'string', true),
            new Aiomatic_Query_Parameter('email', 'Customer email', 'string', true),
            new Aiomatic_Query_Parameter('secondname', 'Customer second name', 'string', false),
            new Aiomatic_Query_Parameter('resource_id', 'Booking resource ID. This is optional, the default resource ID is 1', 'integer', false)
        ],
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_stable_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_stable_diffusion',
        'Call Stable Diffusion AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_google_image_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_google',
        'Call Google AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_midjourney_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_midjourney',
        'Call Midjourney AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_replicate_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_replicate',
        'Call Replicate AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_ideogram_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_ideogram',
        'Call Ideogram AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_cloudflare_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'generate_ai_image_cloudflare',
        'Call Cloudflare AI to generate an image.',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt which will be used for the AI image generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_stable_video_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'create_stable_diffusion_video',
        'Call Stable Diffusion AI to generate a video based on an image URL.',
        [
            new Aiomatic_Query_Parameter('image_url', 'The ULR of the image which will be used as a source for the AI video generator.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_scraper_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'website_scraper',
        'Scrape any website URL and get the resulting content.',
        [
            new Aiomatic_Query_Parameter('url', 'The URL of the website which will be scraped.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_rss_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'rss_feed_parser',
        'Parses RSS feeds and gets their content in a structured way.',
        [
            new Aiomatic_Query_Parameter('url', 'The URL of RSS feed which will be parsed.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_google_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'google_results_parser',
        'Parses Google SERP results and returns top search results.',
        [
            new Aiomatic_Query_Parameter('keywords', 'The search keywords for which the Google Search will be made.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_royalty_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'royalty_free_image_search',
        'Search multiple royalty free image provider websites for an image, based on a keyword.',
        [
            new Aiomatic_Query_Parameter('keyword', 'The search keyword for which a royalty free image will be searched.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_lead_capture_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'lead_capture',
        'Captures leads from users and saves them to the database. Start with the most essential (email). Send more info progressively, when you have it.',
        [
            new Aiomatic_Query_Parameter('email', 'The user\'s email address.', 'string', true),
            new Aiomatic_Query_Parameter('name', 'The user\'s name.', 'string', false),
            new Aiomatic_Query_Parameter('phone_number', 'The user\'s phone number.', 'string', false),
            new Aiomatic_Query_Parameter('job_title', 'The user\'s job title / role.', 'string', false),
            new Aiomatic_Query_Parameter('company_name', 'The user\'s work company name.', 'string', false),
            new Aiomatic_Query_Parameter('location', 'The user\'s current location and address (city, state, address, or country).', 'string', false),
            new Aiomatic_Query_Parameter('birth_date', 'The user\'s birth date.', 'string', false),
            new Aiomatic_Query_Parameter('how_you_found_us', 'How They Found Us - Source of the lead (e.g., Google, social media, referral)', 'string', false),
            new Aiomatic_Query_Parameter('website_url', 'User\'s website URL', 'string', false),
            new Aiomatic_Query_Parameter('preferred_contact_method', 'The user\'s preferred contact method.', 'string', false),
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_youtube_captions_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'youtube_video_captions',
        'Parses and returns the captions of a specific YouTube video, by its URL. This can be used to summarize a video.',
        [
            new Aiomatic_Query_Parameter('url', 'The URL of a YouTube video.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_database_object($realtime_mode = false)
{
    $aiomatic_Chatbot_Settings = get_option('aiomatic_Chatbot_Settings', false);
    if (isset($aiomatic_Chatbot_Settings['database_command_types']) && is_array($aiomatic_Chatbot_Settings['database_command_types']) && !empty($aiomatic_Chatbot_Settings['database_command_types']))
    {
        $allowed_commands = $aiomatic_Chatbot_Settings['database_command_types'];
    }
    else
    {
        $allowed_commands = array('SELECT');
    }
    $return = new Aiomatic_Query_Function(
        'query_wp_database',
        'Executes WordPress database queries, allowing direct interactions with the WordPress database. Only ' . implode(',', $allowed_commands) . ' queries are allowed.',
        [
            new Aiomatic_Query_Parameter('query', 'The WordPress database query which will be executed.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_omniblock_object($realtime_mode = false)
{
    $aiomatic_Chatbot_Settings = get_option('aiomatic_Chatbot_Settings', false);
    if (isset($aiomatic_Chatbot_Settings['god_omniblock_rules']) && !empty(trim($aiomatic_Chatbot_Settings['god_omniblock_rules'])))
    {
        $omniblock_descriptions = [];
        $omni_arr = preg_split('/\r\n|\r|\n/', trim($aiomatic_Chatbot_Settings['god_omniblock_rules']));
        $omni_arr = array_map('trim', $omni_arr);
        $omni_arr = array_filter($omni_arr);
        foreach ($omni_arr as $line) {
            if (strpos($line, '=>') !== false) {
                [$id, $desc] = array_map('trim', explode('=>', $line, 2));
                if (!empty($id) && !empty($desc)) {
                    $omniblock_descriptions[] = "`$id`: $desc";
                }
            }
        }
        $allowed_commands = !empty($omniblock_descriptions)
        ? "\n\nAvailable OmniBlock IDs:\n" . implode("\n", $omniblock_descriptions)
        : "\n\nNo OmniBlocks defined.";
    }
    else
    {
        $allowed_commands = '\n\nNo OmniBlocks defined.';
    }
    $return = new Aiomatic_Query_Function(
        'aimogen_execute_omniblock_rule',
        'You can use this function to execute OmniBlocks, which are defined in the Aimogen settings. The OmniBlock ID is required. Next I will provide you the OmniBlock IDs and their description, which you will be able to execute (each on a new line).' . $allowed_commands,
        [
            new Aiomatic_Query_Parameter('omniblock_id', 'The OmniBlock ID which will be executed. Choose from the available IDs.', 'string', true),
            new Aiomatic_Query_Parameter('input_parameters', 'Add any input parameter you want to pass to the OmniBlock execution queue. You can also leave this empty. You need to provide the input parameters as a valid JSON, like in this example: {"parameter_name":"parameter_value"} ', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_youtube_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'youtube_video_search',
        'Searches YouTube for videos, based on a search keyword string. You can add the returned video URL in an iframe to embed it to a page.',
        [
            new Aiomatic_Query_Parameter('keyword', 'The search keywords for which a YouTube video will be searched.', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_email_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'wp_send_email',
        'Sends an email to a specific email address, with predefined email subject and content.',
        [
            new Aiomatic_Query_Parameter('subject', 'The subject of the email', 'string', true),
            new Aiomatic_Query_Parameter('content', 'The HTML content of the email', 'string', true),
            new Aiomatic_Query_Parameter('recipient_email', 'Defined the email address to which to send the email', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_webhook_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'call_webhook',
        'Calls an external webhook using a predefined list of parameters.',
        [
            new Aiomatic_Query_Parameter('webhook_url', 'The URL of the webhook to be called', 'string', true),
            new Aiomatic_Query_Parameter('method_selector', 'The method to be used when calling the webhook. Possible values are: GET, POST, PUT, DELETE', 'string', true),
            new Aiomatic_Query_Parameter('content_type', 'Set the content type of the called webhook. Possible values are form_data or json', 'string', false),
            new Aiomatic_Query_Parameter('data', 'Set the data to be sent to the webhook. Set the main webhook content. If json was selected in the content_type parameter, enter a valid JSON structure here. If form_data was selected, enter the form data in this format: key => value (add new key/value combinations on a new line)', 'string', false),
            new Aiomatic_Query_Parameter('headers', 'Set any headers to send with the webhook request. Enter the headers in this structure: key => value (add new key/value combinations on a new line). You can also leave this field blank.', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_ai_object($realtime_mode = false)
{
    $aiomatic_Chatbot_Settings = get_option('aiomatic_Chatbot_Settings', false);
    if (isset($aiomatic_Chatbot_Settings['ai_models_recall']) && is_array($aiomatic_Chatbot_Settings['ai_models_recall']))
    {
        $all_models = $aiomatic_Chatbot_Settings['ai_models_recall'];
    }
    else
    {
        $all_models = aiomatic_get_all_models();
    }
    $all_models_str = implode(',', $all_models);
    $return = new Aiomatic_Query_Function(
        'generate_ai_model_reasoning',
        'Processes the provided prompt through an AI model to generate detailed and contextually relevant textual content, simulating a thought process or reasoning path. Use this function when the AI needs to elaborate on a topic, solve a problem, or produce creative and coherent responses based on the input prompt. The \'prompt\' parameter is required and should contain the text or question you want the AI to think about. Optionally, specify the \'model\' parameter to select a particular AI model',
        [
            new Aiomatic_Query_Parameter('prompt', 'The prompt sent to the AI, based on which textual content will be created', 'string', true),
            new Aiomatic_Query_Parameter('model', 'The selected AI model. Possible values are: ' . $all_models_str, 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_toubiz_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'query_toubiz_events',
        'Queries the toubiz events API for information. Supports full-text, date and geo filtering, plus optional language or image data.',
        [
            new Aiomatic_Query_Parameter(
                'search',
                'Full-text search term applied to name, intro and description fields.',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'date_after',
                'Return events on/after this date (YYYY-MM-DD).',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'date_before',
                'Return events on/before this date (YYYY-MM-DD).',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'type',
                'Reach of the event: regional, multiregional or local (comma-separated).',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'event_type',
                'Core type: "event" (fixed dates) or "experience" (on-demand).',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'rectangle_area',
                'Bounding box filter. Format [[SW_lat,SW_lng],[NE_lat,NE_lng]].',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'distance_from',
                'Proximity filter: {latitude, longitude, radiusMeters}.',
                'string',
                false
            ),
            new Aiomatic_Query_Parameter(
                'languages',
                'Comma-separated list of language codes (e.g. "en,de,fr").',
                'string',
                false
            )
        ],
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_facebook_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_facebook_post',
        'Publishes a textual post to Facebook, with an optional URL added to the post.',
        [
            new Aiomatic_Query_Parameter('content', 'The textual content of the Facebook post', 'string', true),
            new Aiomatic_Query_Parameter('url', 'The URL attached to the Facebook post', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_facebook_image_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_facebook_image',
        'Publishes an image post to Facebook, with an optional image caption.',
        [
            new Aiomatic_Query_Parameter('image_url', 'The URL of the image to be published to Facebook', 'string', true),
            new Aiomatic_Query_Parameter('caption', 'An optional image caption text', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_twitter_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_twitter_x_post',
        'Publishes a textual post to Twitter (X), with an optional image URL.',
        [
            new Aiomatic_Query_Parameter('content', 'The textual content of the Twitter (X) post', 'string', true),
            new Aiomatic_Query_Parameter('image_url', 'The optional URL of an image', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_threads_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_threads_post',
        'Publishes a textual post to Threads, with an optional image URL.',
        [
            new Aiomatic_Query_Parameter('content', 'The textual content of the Threads post', 'string', true),
            new Aiomatic_Query_Parameter('image_url', 'The optional URL of an image', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_instagram_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_instagram_post',
        'Publishes an image post to Instagram, with an optional image text.',
        [
            new Aiomatic_Query_Parameter('image_url', 'The image URL to be sent to Instagram', 'string', true),
            new Aiomatic_Query_Parameter('content', 'The optional image description for the Instagram post', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_pinterest_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_pinterest_post',
        'Publishes an image post to Pinterest, with a pin title, description and URL.',
        [
            new Aiomatic_Query_Parameter('image_url', 'The image URL to be sent to Pinterest', 'string', true),
            new Aiomatic_Query_Parameter('title', 'The title of the Pinterest pin', 'string', true),
            new Aiomatic_Query_Parameter('description', 'The description of the Pinterest pin', 'string', true),
            new Aiomatic_Query_Parameter('pin_url', 'The website URL attached to the Pinterest pin', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_google_business_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_google_my_business_post',
        'Publishes a post to Google My Business, with a textual content and an image URL.',
        [
            new Aiomatic_Query_Parameter('content', 'The content of the GMB post', 'string', true),
            new Aiomatic_Query_Parameter('image_url', 'The URL of the image for the GMB post', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_youtube_community_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_youtube_community_post',
        'Publishes a post to YouTube Community, with a textual content and an image URL.',
        [
            new Aiomatic_Query_Parameter('content', 'The content of the YouTube Community post', 'string', true),
            new Aiomatic_Query_Parameter('post_type', 'Set the YouTube Community post type. Possible values are: text, image', 'string', true),
            new Aiomatic_Query_Parameter('image_url', 'The URL of the image for the YouTube Community post.', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_reddit_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_reddit_post',
        'Publishes a post to Reddit, with a textual content and a title.',
        [
            new Aiomatic_Query_Parameter('title', 'The title of the Reddit post', 'string', true),
            new Aiomatic_Query_Parameter('content', 'The content of the Reddit post', 'string', true)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_get_linkedin_object($realtime_mode = false)
{
    $return = new Aiomatic_Query_Function(
        'publish_linkedin_post',
        'Publishes a post to LinkedIn, with a title, link, description, content and image URL.',
        [
            new Aiomatic_Query_Parameter('title', 'The title of the LinkedIn post', 'string', true),
            new Aiomatic_Query_Parameter('content', 'The content of the LinkedIn post', 'string', true),
            new Aiomatic_Query_Parameter('description', 'The description of the LinkedIn post', 'string', false),
            new Aiomatic_Query_Parameter('link', 'The URL attached to the LinkedIn post', 'string', false),
            new Aiomatic_Query_Parameter('image_url', 'The URL of an image, which will be attached to the LinkedIn post', 'string', false)
        ], 
        $realtime_mode
    );
    return $return;
}
function aiomatic_check_god_functions_and_add($function_name, $aiomatic_Chatbot_Settings, $god_extension, $function_call, &$return_arr)
{
    if(in_array($function_name, $god_extension))
    {
        if(function_exists($function_call))
        {
            $return_arr[] = array('type' => 'function', 'function' => $function_call());
        }
    }
    else
    {
        if (isset($aiomatic_Chatbot_Settings[$function_name]) && trim($aiomatic_Chatbot_Settings[$function_name]) == 'on' && function_exists($function_call))
        {
            $return_arr[] = array('type' => 'function', 'function' => $function_call());
        }
    }
}
function aiomatic_return_god_function($god_extension = array())
{
    $return_arr = array();
    $aiomatic_Chatbot_Settings = get_option('aiomatic_Chatbot_Settings', false);
    aiomatic_check_god_functions_and_add('god_mode_enable_wp', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_god_mode_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_chart', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_chart_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_end', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_end_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_dalle', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_dalle_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_amazon', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_amazon_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_clickbank', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_clickbank_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_amazon_details', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_amazon_details_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_booking', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_booking_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_stable', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_stable_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_google_image', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_google_image_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_midjourney', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_midjourney_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_replicate', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_replicate_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_ideogram', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_ideogram_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_cloudflare', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_cloudflare_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_stable_video', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_stable_video_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_scraper', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_scraper_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_rss', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_rss_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_google', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_google_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_royalty', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_royalty_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_lead_capture', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_lead_capture_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_ai', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_ai_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_youtube', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_youtube_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_youtube_captions', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_youtube_captions_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_database', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_database_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_omniblock', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_omniblock_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_email', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_email_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_webhook', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_webhook_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_facebook_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_facebook_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_facebook_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_facebook_image_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_toubiz', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_toubiz_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_twitter_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_twitter_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_threads_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_threads_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_instagram_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_instagram_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_pinterest_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_pinterest_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_google_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_google_business_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_youtube_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_youtube_community_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_reddit_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_reddit_object', $return_arr);
    aiomatic_check_god_functions_and_add('god_mode_enable_linkedin_post', $aiomatic_Chatbot_Settings, $god_extension, 'aiomatic_get_linkedin_object', $return_arr);
    return $return_arr;
}
add_filter('aiomatic_ai_functions', 'aiomatic_add_god_mode', 999, 2);
function aiomatic_add_god_mode($query, $god_extension = false) 
{
    if(is_array($query))
    {
        $functions = $query;
    }
    else
    {
        $functions = array();
    }
    $functions['functions'] = aiomatic_return_god_function($god_extension);
    $functions['message'] = '';
    return $functions;
}
?>