"""
@author: luojunhui
任务常量配置文件
"""


class coldStartTaskConst:
    """
    冷启动任务常量配置
    """
    PUBLISHED_STATUS = 2  # 文章已发布状态
    INIT_STATUS = 1  # 文章初始状态
    BAD_STATUS = 0  # 低质量文章状态


class updatePublishedMsgTaskConst:
    """
    更新已发布文章消息常量配置
    """
    # 爬虫详情接口返回code
    ARTICLE_ILLEGAL_CODE = 25012
    ARTICLE_DELETE_CODE = 25005
    ARTICLE_SUCCESS_CODE = 0
    ARTICLE_UNKNOWN_CODE = 10000

    # 请求爬虫详情接口状态码
    # 记录默认状态
    DEFAULT_STATUS = 0
    # 请求接口失败状态
    REQUEST_FAIL_STATUS = -1
    # 文章被删除状态
    DELETE_STATUS = -2
    # 未知原因无信息返回状态
    UNKNOWN_STATUS = -3
    # 文章违规状态
    ILLEGAL_STATUS = -4

    # 公众号类型（订阅号 or 服务号）
    # 订阅号
    SUBSCRIBE_TYPE_SET = {0, 1}
    # 服务号
    SERVICE_TYPE = 2
    # 监测周期（秒）
    MONITOR_PERIOD = 60 * 60 * 24 * 7

    # 新号抓文章周期
    NEW_ACCOUNT_CRAWL_PERIOD = 60 * 60 * 24 * 30

    # 订阅号，抓取失败失败率报警阈值
    SUBSCRIBE_FAIL_RATE_THRESHOLD = 0.3


class updateAccountReadRateTaskConst:
    """
    更新账号阅读率常量配置
    """
    # 阅读率统计周期（秒）
    STATISTICS_PERIOD = 31 * 24 * 60 * 60
    # 一天的秒数
    ONE_DAY_IN_SECONDS = 60 * 60 * 24
    # 相对变化率阈值
    RELATIVE_VALUE_THRESHOLD = 0.1
    # 发文类型
    UNLIMITED_PUBLISH_TYPE = 10002
    BULK_PUBLISH_TYPE = 9
    # 文章位置
    ARTICLE_INDEX_LIST = [1, 2, 3, 4, 5, 6, 7, 8]


class updateAccountReadAvgTaskConst:
    """
    更新账号阅读均值常量配置
    """
    # 投流账号
    TOULIU_ACCOUNTS = {
        'gh_93e00e187787',
        'gh_ac43e43b253b',
        'gh_68e7fdc09fe4',
        'gh_77f36c109fb1',
        'gh_b181786a6c8c',
        'gh_1ee2e1b39ccf',
        'gh_d3f039c9db2b'
    }

    # 发文模式
    ARTICLES_DAILY = 1
    TOULIU = 2


class WeixinVideoCrawlerConst:
    """
    微信视频抓取常量配置
    """
    # 账号抓取状态
    ACCOUNT_CRAWL_STATUS = 1
    ACCOUNT_DO_NOT_CRAWL_STATUS = 0

    # 默认最早抓取时间戳(2024-01-01)
    DEFAULT_TIMESTAMP = 1704038400

    # 搜索爬虫最大页数
    MAX_SEARCH_PAGE_NUM = 10

    # 抓取每一页的等待时间
    SLEEP_SECONDS = 5

    # 种子标题最低阅读均值倍数
    READ_AVG_MULTIPLE = 1.3

    # 种子标题最低阅读量
    MIN_READ_COUNT = 2000

    # 获取种子标题的统计周期
    STAT_PERIOD = 7 * 24 * 60 * 60

    # 接口请求成功code
    REQUEST_SUCCESS = 0
    PUBLISHED_ILLEGAL_TITLE_CODE = 1015

    # 是否需要扫描查询源账号
    NEED_SCAN_SOURCE_ACCOUNT = 1
    DO_NOT_NEED_SOURCE_ACCOUNT = 0

    # 视频审核状态长文库
    VIDEO_AUDIT_INIT_STATUS = 0
    VIDEO_AUDIT_SUCCESS_STATUS = 1
    VIDEO_AUDIT_FAIL_STATUS = 2
    VIDEO_TITLE_GENERATE_FAIL_STATUS = 4
    VIDEO_AUDIT_PROCESSING_STATUS = -1

    # 票圈视频审核状态, 1 审核中，2 不通过 3 待修改，4 自己可见 5 通过
    PQ_AUDIT_PROCESSING_STATUS = 1
    PQ_AUDIT_FAIL_STATUS = 2
    PQ_AUDIT_WAIT_STATUS = 3
    PQ_AUDIT_SELF_VISIBLE_STATUS = 4
    PQ_AUDIT_SUCCESS_STATUS = 5

    # 默认账号
    DEFAULT_ACCOUNT_UID = 76862180

    # 每天发送的审核视频数量
    MAX_VIDEO_NUM = 500

    # 标题状态
    TITLE_DEFAULT_STATUS = 0
    TITLE_EXIT_STATUS = 1
    TITLE_FESTIVAL_STATUS = 2
    TITLE_DUPLICATE_STATUS = 3
    TITLE_SHORT_STATUS = 4

    # 标题最短长度
    TITLE_MIN_LENGTH = 15


class UpdateMiniProgramDetailConst(updatePublishedMsgTaskConst):
    """
    更新小程序详情常量配置
    """


# 账号联想
class AccountAssociationTaskConst:
    """
    账号联想任务常量配置
    """
    # 获取种子标题的统计周期
    STAT_PERIOD = 7 * 24 * 60 * 60

    # 阅读均值阈值
    READ_AVG_MULTIPLE = 1.3

    # 最小阅读量
    MIN_READ_COUNT = 2000

    # 种子数量限制
    SEED_TITLE_LIMIT = 100


# 从aigc获取文章
class ArticleCollectorConst:
    """
    文章采集任务常量配置
    """
    # 发送方式

    # 手动推送
    MANUAL_PUSH = 1
    # 自动群发
    BULK_AUTO_PUSH = 2
    # 无限流推送
    UNLIMITED_PUSH = 3

    # 文章状态
    # 初始状态
    INIT_STATUS = 0
    # 成功状态
    SUCCESS_STATUS = 1
    # 失败状态
    FAIL_STATUS = -1
    # 发布状态
    PUBLISHED_STATUS = 2

    # 爬虫接口
    ARTICLE_ILLEGAL_CODE = 25012
    ARTICLE_DELETE_CODE = 25005
    ARTICLE_SUCCESS_CODE = 0
    ARTICLE_UNKNOWN_CODE = 10000


# 视频转文本任务
class VideoToTextConst:
    """
    视频转文本任务常量配置
    """
    # SUMMARY_STATUS
    SUMMARY_INIT_STATUS = 0
    SUMMARY_SUCCESS_STATUS = 1
    SUMMARY_FAIL_STATUS = 99
    SUMMARY_LOCK = 101

    # SUMMARY_TASK_BATCH_SIZE
    SUMMARY_BATCH_SIZE = 100

    # bad_status 文章质量状态
    ARTICLE_GOOD_STATUS = 0

    # audit_status 文章审核状态
    AUDIT_SUCCESS_STATUS = 1

    # video understand status
    VIDEO_UNDERSTAND_INIT_STATUS = 0
    VIDEO_UNDERSTAND_PROCESSING_STATUS = 1
    VIDEO_UNDERSTAND_SUCCESS_STATUS = 2
    VIDEO_UNDERSTAND_FAIL_STATUS = 99
    VIDEO_LOCK = 101

    # sleep seconds
    SLEEP_SECONDS = 60

    # time
    MAX_PROCESSING_TIME = 3600

