<?php


namespace WPIS;

require_once __DIR__ . '/PostTypes/EstatePostType.php';
require_once __DIR__ . '/PostTypes/AgentPostType.php';
require_once __DIR__ . '/PostTypes/ProjectPostType.php';

class PostTypesManager extends EstateProperties {

    static public $postTypeMetaPrefix = 'wpis';

    private $enableImportSystem = false;
    private $enableProjectManagement = false;
    private $enableAgentManagement = false;

	static public function init() {

        $class = new self();

        $class->checkSettings();

        if( $class->enableImportSystem ){
            EstatePostType::init();
        }

        if( $class->enableAgentManagement ){
            AgentPostType::init();
        }

        if( $class->enableProjectManagement ){
            ProjectPostType::init();
        }

        return $class;
    }

    private function checkSettings(){
        $this->enableImportSystem      = SettingsManager::get('enableImportSystem');
        $this->enableProjectManagement = SettingsManager::get('enableProjectManagement');
        $this->enableAgentManagement   = SettingsManager::get('enableAgentManagement');
    }
}