# Copyright (c) 2026, Artelys (https://www.artelys.com)
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
#
# @author Léo Rossignol <leo.rossignol at artelys.com>
# @author Alexis Godefroy <alexis.godefroy at artelys.com>
#
import os
import sys

from loguru import logger

# Logger definition
logger.remove()
logger.add(
    sys.stdout,
    format="<green>{time:YYYY-MM-DD HH:mm:ss}</green> | <level>{level: <8}</level>| <cyan>{name}</cyan>: <cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
    level="INFO"
)

# folder paths
MOZAMBIQUE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.join(MOZAMBIQUE_DIR, "project_data")
PREPROCESSING_PATH = os.path.join(MOZAMBIQUE_DIR, "preprocessing")
LOGS_PATH = os.path.join(DATA_PATH, "UC_logs")

# network paths
ORIGINAL_NETWORK = os.path.join(DATA_PATH, "model_mozambique_fixed.xiidm")
NETWORK_WITH_BAT = os.path.join(DATA_PATH, "model_mozambique_1batt.xiidm")
NETWORK_MODIFIED = os.path.join(DATA_PATH, "model_mozambique_simulation_tmp.xiidm")

# csv paths
GEN_DATA = os.path.join(DATA_PATH, "model_mozambique_generators.csv")
LOAD_DATA = os.path.join(DATA_PATH, "model_mozambique_loads.csv")
UC_PATH = os.path.join(DATA_PATH, "UC_init_timeseries.csv")
TS_PATH_GEN = os.path.join(DATA_PATH, "GEN_init_timeseries.csv")
TS_PATH_LOAD = os.path.join(DATA_PATH, "LOAD_init_timeseries.csv")

INITIAL_TIMESERIES = os.path.join(
    DATA_PATH, "init_timeseries_model_mozambique_2batt.csv"
)
PENULTIMATE_TIMESERIES = os.path.join(DATA_PATH, "penultimate_timeseries.csv")
TIMESERIES = os.path.join(DATA_PATH, "UC_timeseries.csv")
RESULTS = os.path.join(DATA_PATH, "UC_results.csv")

# groovy paths
MAPPING_PATH = os.path.join(DATA_PATH, "UC_mapping_file_gen_load.groovy")
CONF_PATH = os.path.join(DATA_PATH, "UC_conf.groovy")
CONTINGENCIES_PATH = os.path.join(DATA_PATH, "UC_contingencies.groovy")
