# from typing import List
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Enum
from sqlalchemy.orm import relationship, declarative_base, sessionmaker

from .show import Base


class TrackTag(Base):
    """
    relationship(argument, opt1, opt2, ...)
    argument is string of class or Mapped class of the target entity
    backref creates a bi-directional corresponding relationship (back_populates preferred)
    back_populates points to the corresponding relationship (the actual class attribute identifier)
    
    See: https://docs.sqlalchemy.org/en/(14|20)/orm/basic_relationships.html
    """

    __tablename__ = 'track_tags'

    # v1.x
    id = Column(Integer, primary_key=True)

    key = Column(String)
    value = Column(String)

    # v1.x
    track_id = Column(Integer, ForeignKey('tracks.id', ondelete="CASCADE"))
    track = relationship('Track', back_populates='track_tags')
