from typing import TYPE_CHECKING

from sqlalchemy import Column, ForeignKey, Integer, String, Enum, DateTime, Text
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base_class import Base


if TYPE_CHECKING:
  from .user import User  # noqa: F401
  from .enum import Progress

class SimplePay(Base):
  id = Column(Integer, primary_key=True, index=True)
  email = Column(String(50), index=True, nullable=False)
  name = Column(String(30), index=True)
  taxID = Column(String(20))
  tradeDesc = Column(String(20))
  item = Column(String(20), nullable=False)
  amount = Column(Integer, nullable=False)
  created_datetime = Column(DateTime(timezone=True), default=func.now())
  payment_state = Column(String(10), default='waiting', nullable=False)
  epayment = Column(String(10), 
                    ForeignKey("epayment.name", ondelete="RESTRICT", onupdate="CASCADE"),
                    default="ecpay")
  remark = Column(Text)
  