# Path: jarr/bootstrap.py
# def is_secure_served():
# def init_logging(log_path=None, log_level=logging.INFO, modules=(),
#                  log_format='%(asctime)s %(levelname)s %(message)s'):
# def init_db(echo=False):
# def init_models():
# def commit_pending_sql(*args, **kwargs):
# def rollback_pending_sql(*args, **kwargs):
# REDIS_CONN = Redis(host=conf.db.redis.host,
#                    db=conf.db.redis.db,
#                    port=conf.db.redis.port)
# 
# Path: jarr/lib/enums.py
# class ArticleType(Enum):
#     image = 'image'
#     video = 'video'
#     audio = 'audio'
#     embedded = 'embedded'
# 
# class ClusterReason(Enum):
#     original = 'original'  # the article is the cluster's original one
#     # the article has the same name and share a suitable category
#     title = 'title'
#     # the article has the same link that the main one of the cluster
#     link = 'link'
#     tf_idf = 'tf_idf'  # the article has been clustered through tf_idf
# 
# Path: jarr/lib/utils.py
# def utc_now():
#     return datetime.utcnow().replace(tzinfo=timezone.utc)
# 
# Path: jarr/models/utc_datetime_type.py
# class UTCDateTime(types.TypeDecorator):
#     impl = types.DateTime
#     python_type = datetime
#     cache_ok = True
# 
#     @staticmethod
#     def process_bind_param(value, dialect):
#         if value is not None:
#             if not value.tzinfo:
#                 value = value.replace(tzinfo=timezone.utc)
#             return value.astimezone(timezone.utc).replace(tzinfo=None)
#         return value
# 
#     @staticmethod
#     def process_result_value(value, dialect):
#         if value is not None:
#             if value.tzinfo:
#                 raise ValueError(f"{value!r} tzinfo is defined, shouldn't be")
#             return value.replace(tzinfo=timezone.utc)
#         return value
# 
#     @staticmethod
#     def process_literal_param(value, dialect):
#         raise NotImplementedError(f"can't process {value!r} for {dialect!r}")


from functools import cached_property
from jarr.bootstrap import Base
from jarr.lib.clustering_af.vector import TFIDFVector, get_simple_vector
from jarr.lib.enums import ArticleType, ClusterReason
from jarr.lib.utils import utc_now
from jarr.models.utc_datetime_type import UTCDateTime
from sqlalchemy import (Column, Enum, ForeignKeyConstraint, Index, Integer,
                        LargeBinary, PickleType, String)
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import RelationshipProperty, relationship
        from jarr.lib.content_generator import get_content_generator



class Article(Base):  # type: ignore
    "Represent an article from a feed."
    __tablename__ = 'article'

    id = Column(Integer, primary_key=True)
    entry_id = Column(String)
    link = Column(String)
    link_hash = Column(LargeBinary)
    title = Column(String)
    content = Column(String)
    comments = Column(String)
    lang = Column(String)
    date = Column(UTCDateTime, default=utc_now)

# Path: jarr/bootstrap.py
# def is_secure_served():
# def init_logging(log_path=None, log_level=logging.INFO, modules=(),
#                  log_format='%(asctime)s %(levelname)s %(message)s'):
# def init_db(echo=False):
# def init_models():
# def commit_pending_sql(*args, **kwargs):
# def rollback_pending_sql(*args, **kwargs):
# REDIS_CONN = Redis(host=conf.db.redis.host,
#                    db=conf.db.redis.db,
#                    port=conf.db.redis.port)
# 
# Path: jarr/lib/enums.py
# class ArticleType(Enum):
#     image = 'image'
#     video = 'video'
#     audio = 'audio'
#     embedded = 'embedded'
# 
# class ClusterReason(Enum):
#     original = 'original'  # the article is the cluster's original one
#     # the article has the same name and share a suitable category
#     title = 'title'
#     # the article has the same link that the main one of the cluster
#     link = 'link'
#     tf_idf = 'tf_idf'  # the article has been clustered through tf_idf
# 
# Path: jarr/lib/utils.py
# def utc_now():
#     return datetime.utcnow().replace(tzinfo=timezone.utc)
# 
# Path: jarr/models/utc_datetime_type.py
# class UTCDateTime(types.TypeDecorator):
#     impl = types.DateTime
#     python_type = datetime
#     cache_ok = True
# 
#     @staticmethod
#     def process_bind_param(value, dialect):
#         if value is not None:
#             if not value.tzinfo:
#                 value = value.replace(tzinfo=timezone.utc)
#             return value.astimezone(timezone.utc).replace(tzinfo=None)
#         return value
# 
#     @staticmethod
#     def process_result_value(value, dialect):
#         if value is not None:
#             if value.tzinfo:
#                 raise ValueError(f"{value!r} tzinfo is defined, shouldn't be")
#             return value.replace(tzinfo=timezone.utc)
#         return value
# 
#     @staticmethod
#     def process_literal_param(value, dialect):
#         raise NotImplementedError(f"can't process {value!r} for {dialect!r}")


# Path: jarr/models/article.py
from functools import cached_property
from jarr.bootstrap import Base
from jarr.lib.clustering_af.vector import TFIDFVector, get_simple_vector
from jarr.lib.enums import ArticleType, ClusterReason
from jarr.lib.utils import utc_now
from jarr.models.utc_datetime_type import UTCDateTime
from sqlalchemy import (Column, Enum, ForeignKeyConstraint, Index, Integer,
                        LargeBinary, PickleType, String)
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import RelationshipProperty, relationship
        from jarr.lib.content_generator import get_content_generator




class Article(Base):  # type: ignore
    "Represent an article from a feed."
    __tablename__ = 'article'

    id = Column(Integer, primary_key=True)
    entry_id = Column(String)
    link = Column(String)
    link_hash = Column(LargeBinary)
    title = Column(String)
    content = Column(String)
    comments = Column(String)
    lang = Column(String)
    date = Column(UTCDateTime, default=utc_now)

    retrieved_date = Column(UTCDateTime, default=utc_now)