# 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 FeedStatus(Enum):
#     active = 'active'
#     paused = 'paused'
#     to_delete = 'to_delete'
#     deleting = 'deleting'
# 
# class FeedType(Enum):
#     classic = 'classic'
#     json = 'json'
#     tumblr = 'tumblr'
#     instagram = 'instagram'
#     soundcloud = 'soundcloud'
#     reddit = 'reddit'
#     koreus = 'koreus'
#     twitter = 'twitter'
# 
# 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 flask import url_for
from jarr.bootstrap import Base
from jarr.lib.const import UNIX_START
from jarr.lib.enums import FeedStatus, FeedType
from jarr.lib.utils import utc_now
from jarr.models.utc_datetime_type import UTCDateTime
from sqlalchemy import (Boolean, Column, Enum, ForeignKeyConstraint, Index,
                        Integer, PickleType, String)
from sqlalchemy.orm import RelationshipProperty, relationship, validates
        from jarr.crawler.crawlers import AbstractCrawler


class Feed(Base):  # type: ignore
    __tablename__ = 'feed'

    id = Column(Integer, primary_key=True)
    title = Column(String, default="")
    description = Column(String, default="")
    link = Column(String)
    site_link = Column(String, default="")
    status = Column(Enum(FeedStatus), default=FeedStatus.active,
                    nullable=False)
    created_date = Column(UTCDateTime, default=utc_now)
    filters = Column(PickleType, default=[])

    # integration control
    feed_type = Column(Enum(FeedType),

# 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 FeedStatus(Enum):
#     active = 'active'
#     paused = 'paused'
#     to_delete = 'to_delete'
#     deleting = 'deleting'
# 
# class FeedType(Enum):
#     classic = 'classic'
#     json = 'json'
#     tumblr = 'tumblr'
#     instagram = 'instagram'
#     soundcloud = 'soundcloud'
#     reddit = 'reddit'
#     koreus = 'koreus'
#     twitter = 'twitter'
# 
# 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/feed.py
from flask import url_for
from jarr.bootstrap import Base
from jarr.lib.const import UNIX_START
from jarr.lib.enums import FeedStatus, FeedType
from jarr.lib.utils import utc_now
from jarr.models.utc_datetime_type import UTCDateTime
from sqlalchemy import (Boolean, Column, Enum, ForeignKeyConstraint, Index,
                        Integer, PickleType, String)
from sqlalchemy.orm import RelationshipProperty, relationship, validates
        from jarr.crawler.crawlers import AbstractCrawler



class Feed(Base):  # type: ignore
    __tablename__ = 'feed'

    id = Column(Integer, primary_key=True)
    title = Column(String, default="")
    description = Column(String, default="")
    link = Column(String)
    site_link = Column(String, default="")
    status = Column(Enum(FeedStatus), default=FeedStatus.active,
                    nullable=False)
    created_date = Column(UTCDateTime, default=utc_now)
    filters = Column(PickleType, default=[])

    # integration control
    feed_type = Column(Enum(FeedType),

                       default=FeedType.classic, nullable=False)