"""Chore model.""" from sqlalchemy import Boolean, Column, Integer, String, DateTime, ForeignKey, Enum as SQLEnum from sqlalchemy.orm import relationship from datetime import datetime from app.core.database import Base import enum class ChoreFrequency(str, enum.Enum): """Chore frequency options.""" ON_TRIGGER = "on_trigger" DAILY = "daily" WEEKLY = "weekly" FORTNIGHTLY = "fortnightly" MONTHLY = "monthly" class ChoreStatus(str, enum.Enum): """Chore status options.""" PENDING = "pending" IN_PROGRESS = "in_progress" COMPLETED = "completed" SKIPPED = "skipped" class ChoreAssignmentType(str, enum.Enum): """Chore assignment type - how the chore should be completed.""" ANY_ONE = "any_one" # Only one assigned person needs to complete ALL_ASSIGNED = "all_assigned" # All assigned people must complete class Chore(Base): """Chore model.""" __tablename__ = "chores" id = Column(Integer, primary_key=True, index=True) title = Column(String(200), nullable=False) description = Column(String(500)) room = Column(String(50)) # bedroom1, bedroom2, kitchen, bathroom1, etc. <<<<<<< HEAD frequency = Column(SQLEnum(ChoreFrequency, values_callable=lambda x: [e.value for e in x]), nullable=False) points = Column(Integer, default=0) # Points awarded for completing the chore image_url = Column(String(500)) # URL to chore image assignment_type = Column(SQLEnum(ChoreAssignmentType, values_callable=lambda x: [e.value for e in x]), default=ChoreAssignmentType.ANY_ONE) # How chore should be completed status = Column(SQLEnum(ChoreStatus, values_callable=lambda x: [e.value for e in x]), default=ChoreStatus.PENDING) ======= frequency = Column(SQLEnum(ChoreFrequency), nullable=False) points = Column(Integer, default=0) # Points awarded for completing the chore image_url = Column(String(500)) # URL to chore image assignment_type = Column(SQLEnum(ChoreAssignmentType), default=ChoreAssignmentType.ANY_ONE) # How chore should be completed status = Column(SQLEnum(ChoreStatus), default=ChoreStatus.PENDING) >>>>>>> 65c71b3d67d462fe9ecc01a1c2aa17e54b626fe2 assigned_user_id = Column(Integer, ForeignKey("users.id")) # Deprecated - use assignments instead due_date = Column(DateTime) completed_at = Column(DateTime) created_at = Column(DateTime, default=datetime.utcnow) updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) # Relationships assigned_user = relationship("User", back_populates="chores") # Deprecated - use assignments assignments = relationship("ChoreAssignment", back_populates="chore", cascade="all, delete-orphan")