<?php

namespace TableBuilderPro\Config;

defined('ABSPATH') || exit;

class Blocks
{
	private static $instance = null;

	public static function instance()
	{
		if (self::$instance === null) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	private function __construct()
	{
		add_filter('tablebuilder/blocks/list', [$this, 'set_pro_blocks_list']);
	}

	public function set_pro_blocks_list($blocks)
	{
		$blocks_list = array_merge($blocks, $this->get_blocks_list());
		return $blocks_list;
	}

	public function get_blocks_list()
	{
		$blocks = [
			'data-table' => [
				'slug'     => 'data-table',
				'title'    => 'Data Table',
				'package'  => 'pro',
				'category' => 'general',
				'status'   => 'active',
			],
			'post-table' => [
				'slug'     => 'post-table',
				'title'    => 'Post Table',
				'package'  => 'pro',
				'category' => 'general',
				'status'   => 'active',
			]
		];

		return $blocks;
	}
}
