from sqlalchemy import Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from src.core.models.base import Base



class CrawlProperty(Base):
    """
    Model representing properties of web crawler data.
    
    This model maps the relationship between web crawler and wine properties,
    defining which properties should be extracted from crawled data.
    """
    __tablename__ = "crawl_properties"
    
    id = Column(Integer, primary_key=True)
    web_crawler_id = Column(Integer, ForeignKey('web_crawlers.id'), nullable=False)
    wine_property = Column(String, nullable=False)  # Should be a value from WineProperty enum
    custom_label = Column(String)
    property_index = Column(Integer, nullable=False)
    data_output = Column(Boolean, default=True)
    selectors = Column(String, nullable=True)
    
    # Relationships
    # web_crawler = relationship("WebCrawler", back_populates="crawl_properties")
    