from sqlalchemy import ForeignKey, Column, Integer, JSON, TIMESTAMP, String, Enum, Text from sqlalchemy.orm import relationship from .base_model import Base class Shop(Base): __tablename__ = 'shop' id = Column(Integer, primary_key=True) owner_id = Column(Integer, ForeignKey('user.id'), nullable=False) name = Column(String(100), unique=True, nullable=False) description = Column(String(500), nullable=False) created_at = Column(TIMESTAMP, default='CURRENT_TIMESTAMP') updated_at = Column(TIMESTAMP, default='CURRENT_TIMESTAMP') status = Column(Enum('active', 'inactive', 'suspended'), nullable=False) logo = Column(String(100)) contact_email = Column(String(128), unique=True, nullable=False) phone_number = Column(String(15), nullable=False) address = Column(Text, nullable=False) currency = Column(String(3), nullable=False) business_hours = Column(JSON, nullable=False) links = Column(JSON, nullable=False) users = relationship('User', back_populates='shop') products = relationship('Product', back_populates='shop')