import os

class Config:
    # 基础配置
    SECRET_KEY = os.getenv("SECRET_KEY", "vision-ai-secret-key")
    
    # PostgreSQL 配置
    SQLALCHEMY_DATABASE_URI = "postgresql://user_xREpkJ:password_DZz8DQ@331002.xyz:2022/ai_vision"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    
    # Redis 配置
    REDIS_URL = "redis://:redis_WWjNyb@331002.xyz:2020/0"
    
    # Session 配置
    PERMANENT_SESSION_LIFETIME = 604800  # 7 天 (单位：秒)
    SESSION_COOKIE_SECURE = False        # 开发环境或非 HTTPS 生产环境设为 False
    SESSION_COOKIE_HTTPONLY = True       # 防止 XSS 获取 Cookie
    
    # MinIO 配置
    MINIO = {
        "endpoint": "http://331002.xyz:9000",
        "access_key": "l0VlsxrkASbXN2YSQrJk",
        "secret_key": "ZK8nXHieorl3fpbssUMGGfr8zZmbpXB5gAbma3z1",
        "bucket": "images",
        "public_url": "http://331002.xyz:9000/images/"
    }
    
    # AI API 配置
    AI_API = "https://ai.t8star.cn/v1/images/generations"
    
    # 试用模式配置
    TRIAL_API = "https://ai.comfly.chat/v1/images/generations"
    TRIAL_KEY = "sk-Rr8L5noW8Qga7K4jmey3yYZYL1a4SlhlNlo5iZrwqJRK1Pa1"
    PREMIUM_KEY = "sk-168trRxnemem6nTpQn1rbmJ4SFKLwTMsZ0G6uk5OipP7FKAY"
    
    DICT_URL = "https://nas.4x4g.com:10011/api/common/sys/dict"
    PLATFORM = "lingmao"
    
    # 阿里云短信配置
    ALIBABA_CLOUD_ACCESS_KEY_ID = "LTAI5tAbHKxmPKVPYsABEdyq"
    ALIBABA_CLOUD_ACCESS_KEY_SECRET = "v6URREddBqvGfwZrWH1DWoxs3w6RxZ"
    SMS_SIGN_NAME = "速通互联验证码"
    SMS_TEMPLATE_CODE = "100001"
    SMS_NEED_PARAM = False  # 该模板需要参数，如使用系统赠送模板请改为 False
    
    # 开发模式配置
    DEV_MODE = False  # True=开发模式（固定验证码），False=生产模式（真实短信）
    DEV_SMS_CODE = "888888"  # 开发模式下的固定验证码
