"""Package-level constants.

Every value a team might need to touch lives here; the functions read from
this module. The MATLAB counterpart is matlab/config.m.
"""

from __future__ import annotations

import os
from typing import Optional, Tuple

# Submission format
LABEL_FS: float = 128.0                                  # Hz, the grid every prediction CSV is written on
PREDICTION_PREFIX: str = "test_sample_"                  # <prefix><subject id>.csv, one file per subject
PREDICTION_NAME_FMT: str = "test_sample_{:03d}.csv"
LABEL_COLUMNS: Tuple[str, ...] = ("time_index", "label", "trial")
METADATA_NAME: str = "submission_metadata.yaml"
METADATA_KEYS: Tuple[str, ...] = ("label_type", "code_public", "decoder_lookahead_ms")
MAX_LOOKAHEAD_MS: float = 1000.0                         # challenge rule; enforced by the scoring program
LABEL_TYPES: Tuple[str, ...] = ("attended-speaker-label", "attended-direction-label")

# Data layout (extended CND)
NEURAL_PREFIX: str = "dataSub"                           # raw EEG file stem, <prefix><id>.mat
STIM_PREFIX: str = "dataStim"                            # raw envelope file stem
PREPROCESSED_MARKER: str = "pre_"                        # prepended to a stem for the 32 Hz copies
RAW_PREFIXES: Tuple[str, str] = (NEURAL_PREFIX, STIM_PREFIX)
PREFERRED_PREFIXES: Tuple[str, str] = (PREPROCESSED_MARKER + NEURAL_PREFIX,
                                       PREPROCESSED_MARKER + STIM_PREFIX)

# Test sets
SET_NAMES: Tuple[str, ...] = ("nju", "dlaad")

# Decision window override. None uses the value in reference_decoder.mat; a
# number overrides it with a warning.
WINDOW_SECONDS: Optional[float] = None
HOP_SAMPLES: int = 1                                     # samples between window starts

# Decoder file
DECODER_REL_PATH: str = os.path.join("matlab", "reference_decoder.mat")
