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

class CookieIntegrationConfig(Base):
    __tablename__ = 'cookie_integration_configs'
    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    ga_measurement_id = Column(String(64), nullable=True)
    fb_pixel_id = Column(String(64), nullable=True)
    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')