# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/03c_data.core.ipynb.

# %% auto 0
__all__ = ['Component', 'Label', 'ClassMap', 'Metadata']

# %% ../../nbs/03c_data.core.ipynb 2
from fastcore.all import *
from collections import UserDict
import polvo as pv

# %% ../../nbs/03c_data.core.ipynb 3
# Still needs to be figured out
class Component:
    ...

# %% ../../nbs/03c_data.core.ipynb 4
class Label:
    def __init__(self, id, name): store_attr()
    def __repr__(self): return f'{self.id}: {self.name}'
    def __eq__(self, other): 
        return isinstance(other, Label) and (self.id, self.name) == (other.id, other.name)
    def __hash__(self): return hash((self.id, self.name))

# %% ../../nbs/03c_data.core.ipynb 6
class ClassMap:
    def __init__(self, *labels): 
        self.labels = labels
        self.id2name = {l.id: l.name for l in labels}
        self.name2id = {l.name: l.id for l in labels}
        self.id2label = {l.id: l for l in labels}
        self.name2label = {l.name: l for l in labels}
        
    def __len__(self): return len(self.labels)
    def __repr__(self): return f'<{self.__class__.__name__} {self.name2id}>'

# %% ../../nbs/03c_data.core.ipynb 7
class Metadata(UserDict):
    def accept_visit(self, visitor): return visitor.visit_metadata(self)
