<?php
namespace MetaBox\CustomTable\Model;

class Factory {
	private static $data = [];

	public static function make( $name, $args ) {
		$model = new Model( $name, $args );
		self::add( $name, $model );

		new Admin( $model );
		new SupportData( $model );
		new TableSchema( $model );

		return $model;
	}

	public static function get( $key = null ) {
		if ( is_null( $key ) ) {
			return self::$data;
		}

		return self::$data[ $key ] ?? null;
	}

	public static function add( $key, $value ) {
		self::$data[ $key ] = $value;
	}
}
