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

# %% auto 0
__all__ = ['SEP', 'BAR', 'TEE', 'END', 'TreeChr']

# %% ../nbs/03_tree.ipynb 4
from enum import StrEnum
from typing import Optional

from .core import SPACE, PIPE

# %% ../nbs/03_tree.ipynb 6
SEP = '    ' # space   SPACE * 4
BAR = '│   ' # branch  PIPE + SPACE * 3
TEE = '├── ' # tee
END = '└── ' # last

# %% ../nbs/03_tree.ipynb 8
class TreeChr(StrEnum):
    SEP = SEP # space
    BAR = BAR # branch
    TEE = TEE # tee
    END = END # last

    @classmethod
    def next(cls, curr: 'TreeChr') -> 'TreeChr':
        return cls.BAR if curr == cls.TEE else cls.SEP
    
    @classmethod
    def join(cls, prev: Optional[str] = None, curr: Optional['TreeChr'] = None) -> str:
        return f'{prev or ""}{cls.next(curr or cls.TEE)}'
