from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
from sqlalchemy.orm import relationship
from ...shared.config.database import Base

class CookiePolicy(Base):
    __tablename__ = 'cookie_policies'
    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    analytics_enabled = Column(Boolean, default=True, nullable=False)
    marketing_enabled = Column(Boolean, default=True, nullable=False)
    preferences_enabled = Column(Boolean, default=True, nullable=False)
    created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
    updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
    updated_by_id = Column(Integer, ForeignKey('users.id'), nullable=True)
    updated_by = relationship('User', lazy='joined')