<?php

namespace HulkPlugins\ElementorPro\Forms\AdvancedFields\Services;

use HulkPlugins\ElementorPro\Forms\AdvancedFields\Models\SettingsModel;
use HulkPlugins\ElementorPro\Forms\AdvancedFields\Traits\SingletonTrait;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class SettingsService {
	use SingletonTrait;

	private static SettingsService $instance;
	private SettingsModel $model;

	/**
	 * Sets up the SettingsService.
	 *
	 * Sets up the SettingsModel instance.
	 *
	 * @return void
	 */
	private function __construct( SettingsModel $model ) {
		$this->model = $model;
	}

	public static function getInstance( SettingsModel $model ): self {
		if ( ! isset( self::$instance ) ) {
			self::$instance = new self( $model );
		}

		return self::$instance;
	}

	/**
	 * Gets all settings
	 */
	public function getSettings(): array {
		return $this->model->getSettings();
	}

	/**
	 * Get supported fields
	 * @return array
	 */
	public function getSupportedFields(): array {
		return $this->model->getSupportedFields();
	}
}
