"""."""

import copy

from typing import Callable
from unittest.mock import MagicMock

import numpy as np

from kinematic_tracker.types import FMT, IVT


class ScoreCopy:
    def __init__(self, num_cls: int) -> None:
        self.num_cls = num_cls
        self.score_crt = np.empty(num_cls, dtype=object)
        self.creation_ids_ct = np.empty(num_cls, dtype=object)

    def set(self, cls: int, creation_ids: Callable[[int], IVT], score_rt: FMT) -> None:
        self.score_crt[cls] = score_rt.copy()
        self.creation_ids_ct[cls] = creation_ids(cls)

    def copy(self) -> 'ScoreCopy':
        return copy.copy(self)


def get_score_copy(return_score: bool, num_cls: int) -> ScoreCopy | MagicMock:
    if return_score:
        return ScoreCopy(num_cls)
    return MagicMock()
