from sqlalchemy import Column, Integer, Boolean

from components.component import Component, component_repr


class AnimationManager(Component):
    """Track animation information."""
    __tablename__ = 'animation_manager'
    id = Column(Integer, primary_key=True)
    entity = Column(Integer, unique=True, index=True, nullable=False)
    next_frame = Column(Integer, default=0)  # index of current frame
    update_delay = Column(Integer, default=250)
    active = Column(Boolean, default=True)
    next_update = Column(Integer, default=0)

    def __repr__(self):
        return component_repr(self)
