from sqlalchemy import Column, Integer, String, Text, DateTime, Boolean, Enum as SQLEnum
from sqlalchemy.orm import relationship
from datetime import datetime
import enum
from ..config.database import Base

class PageType(str, enum.Enum):
    HOME = 'home'
    CONTACT = 'contact'
    ABOUT = 'about'
    FOOTER = 'footer'
    SEO = 'seo'
    PRIVACY = 'privacy'
    TERMS = 'terms'
    REFUNDS = 'refunds'
    CANCELLATION = 'cancellation'
    ACCESSIBILITY = 'accessibility'
    FAQ = 'faq'

class PageContent(Base):
    __tablename__ = 'page_contents'
    id = Column(Integer, primary_key=True, index=True)
    page_type = Column(SQLEnum(PageType, values_callable=lambda x: [e.value for e in x], native_enum=False, length=50), nullable=False, unique=True, index=True)
    title = Column(String(500), nullable=True)
    subtitle = Column(String(1000), nullable=True)
    description = Column(Text, nullable=True)
    content = Column(Text, nullable=True)
    meta_title = Column(String(500), nullable=True)
    meta_description = Column(Text, nullable=True)
    meta_keywords = Column(String(1000), nullable=True)
    og_title = Column(String(500), nullable=True)
    og_description = Column(Text, nullable=True)
    og_image = Column(String(1000), nullable=True)
    canonical_url = Column(String(1000), nullable=True)
    contact_info = Column(Text, nullable=True)
    map_url = Column(String(1000), nullable=True)
    social_links = Column(Text, nullable=True)
    footer_links = Column(Text, nullable=True)
    badges = Column(Text, nullable=True)
    copyright_text = Column(Text, nullable=True)
    hero_title = Column(String(500), nullable=True)
    hero_subtitle = Column(String(1000), nullable=True)
    hero_image = Column(String(1000), nullable=True)
    story_content = Column(Text, nullable=True)
    values = Column(Text, nullable=True)
    features = Column(Text, nullable=True)
    about_hero_image = Column(Text, nullable=True)
    mission = Column(Text, nullable=True)
    vision = Column(Text, nullable=True)
    team = Column(Text, nullable=True)
    timeline = Column(Text, nullable=True)
    achievements = Column(Text, nullable=True)
    luxury_section_title = Column(Text, nullable=True)
    luxury_section_subtitle = Column(Text, nullable=True)
    luxury_section_image = Column(Text, nullable=True)
    luxury_features = Column(Text, nullable=True)
    luxury_gallery_section_title = Column(Text, nullable=True)
    luxury_gallery_section_subtitle = Column(Text, nullable=True)
    luxury_gallery = Column(Text, nullable=True)
    luxury_testimonials_section_title = Column(Text, nullable=True)
    luxury_testimonials_section_subtitle = Column(Text, nullable=True)
    luxury_testimonials = Column(Text, nullable=True)
    amenities_section_title = Column(String(500), nullable=True)
    amenities_section_subtitle = Column(String(1000), nullable=True)
    amenities = Column(Text, nullable=True)
    testimonials_section_title = Column(String(500), nullable=True)
    testimonials_section_subtitle = Column(String(1000), nullable=True)
    testimonials = Column(Text, nullable=True)
    gallery_section_title = Column(String(500), nullable=True)
    gallery_section_subtitle = Column(String(1000), nullable=True)
    gallery_images = Column(Text, nullable=True)
    about_preview_title = Column(String(500), nullable=True)
    about_preview_subtitle = Column(String(1000), nullable=True)
    about_preview_content = Column(Text, nullable=True)
    about_preview_image = Column(String(1000), nullable=True)
    stats = Column(Text, nullable=True)
    luxury_services_section_title = Column(Text, nullable=True)
    luxury_services_section_subtitle = Column(Text, nullable=True)
    luxury_services = Column(Text, nullable=True)
    luxury_experiences_section_title = Column(Text, nullable=True)
    luxury_experiences_section_subtitle = Column(Text, nullable=True)
    luxury_experiences = Column(Text, nullable=True)
    awards_section_title = Column(Text, nullable=True)
    awards_section_subtitle = Column(Text, nullable=True)
    awards = Column(Text, nullable=True)
    cta_title = Column(Text, nullable=True)
    cta_subtitle = Column(Text, nullable=True)
    cta_button_text = Column(Text, nullable=True)
    cta_button_link = Column(Text, nullable=True)
    cta_image = Column(Text, nullable=True)
    partners_section_title = Column(Text, nullable=True)
    partners_section_subtitle = Column(Text, nullable=True)
    partners = Column(Text, nullable=True)
    is_active = 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)