<?php

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

/*
 * Generate json file for AI
 * Usage:
 * wp webien-ai generate
 *
*/


class WebienAI extends WP_CLI_Command
{

    private $log;
    private $verbose = false;

    public function generate($args, $assoc_args)
    {
        $arguments = wp_parse_args(
            $assoc_args, []
        );
        if ( isset($arguments['verbose']) ) {
            $this->verbose = true;
        }

        // create a log channel
        $this->log = new Logger('AI');
        $this->log->pushHandler(new StreamHandler(WP_CONTENT_DIR . '/webien.log'));

        (new \Webien\AI\Dashboard\Dashboard())->generate();
        $this->log->info('Generated source');

        WP_CLI::success( 'Done' );

    }


}

WP_CLI::add_command('webien-ai', 'WebienAI');