/**
 * Author: dkanus
 * Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
 * License: GPL
 * Copyright 2021-2024 Anton Tarasenko
 *------------------------------------------------------------------------------
 * This file is part of Acedia.
 *
 * Acedia is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License, or
 * (at your option) any later version.
 *
 * Acedia is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Acedia.  If not, see <https://www.gnu.org/licenses/>.
 */
 class GameplayAPI extends AcediaObject
    abstract;

//! Base class for all frontends. Does not define anything meaningful, which
//! also means it does not put any limitations on it's implementation.

var private config class<TemplatesGameplayAPI> templatesClass;
var public TemplatesGameplayAPI templates;

var private config class<AWorldComponent>       worldClass;
var public AWorldComponent                      world;

var private config class<TradingGameplayAPI>    tradingClass;
var public TradingGameplayAPI                   trading;

var private config class<RoundsGameplayAPI> wavesClass;
var public RoundsGameplayAPI                waves;

var private config class<HealthGameplayAPI> healthClass;
var public HealthGameplayAPI health;

protected function Constructor()
{
    if (templatesClass != none) {
        templates = TemplatesGameplayAPI(_.memory.Allocate(templatesClass));
    }
    if (worldClass != none) {
        world = AWorldComponent(_.memory.Allocate(worldClass));
    }
    if (tradingClass != none) {
        trading = TradingGameplayAPI(_.memory.Allocate(tradingClass));
    }
    if (wavesClass != none) {
        waves = RoundsGameplayAPI(_.memory.Allocate(wavesClass));
    }
    if (healthClass != none) {
        health = HealthGameplayAPI(_.memory.Allocate(healthClass));
    }
}

protected function Finalizer()
{
    _.memory.Free(templates);
    _.memory.Free(world);
    _.memory.Free(trading);
    _.memory.Free(waves);
    _.memory.Free(health);
    templates = none;
    world = none;
    trading = none;
    waves   = none;
    health  = none;
}

defaultproperties
{
    templatesClass  = none
    worldClass      = none
}