package com.usky.issue.service.constant;

/**
 * 云平台集成常量
 *
 * @author fyc
 * @date 2026-05-21
 */
public final class CloudIntegrationConstants {

    private CloudIntegrationConstants() {
    }

    public static final String LOCK_SYNC_PREFIX = "cloud:sync:";
    public static final long LOCK_SYNC_SECONDS = 30L;

    public static final String CACHE_STATUS_PREFIX = "cloud:sync:status:";
    public static final long CACHE_STATUS_TTL_SECONDS = 5L;

    public static final int CONNECTION_TEST_TIMEOUT_MS = 10_000;

    public static final String HEADER_TENANT_ID = "X-Tenant-Id";
    public static final String HEADER_API_KEY = "X-Api-Key";
    public static final String HEADER_SIGN = "X-Sign";

    public static final String PATH_TEST_CONNECTION = "/testConnection";
    public static final String PATH_PING = "/ping";
    public static final String PATH_AUTH_CHECK = "/auth-check";
    public static final String PATH_SYNC_RECEIVE = "/sync/receive";
    public static final String PATH_SYNC_POLL = "/sync/poll";
    public static final String PATH_SYNC_POLL_ACK = "/sync/poll/ack";

    public static final String AUTH_CHECK_VALID = "VALID";
    public static final String AUTH_CHECK_TENANT_MISSING = "TENANT_MISSING";

    public static final String MSG_TENANT_CONFIG_MISSING = "租户配置缺失";
    public static final String MSG_AUTH_INVALID = "认证失败：API Key无效";
    public static final String MSG_CONNECTION_SUCCESS = "连接成功";
    public static final String MSG_NETWORK_UNREACHABLE = "云平台网络不可达";

    public static final String OPERATION_SAVE_CONFIG = "SAVE_CONFIG";
    public static final String OPERATION_TEST_CONNECTION = "TEST_CONNECTION";
    public static final String OPERATION_DISABLE = "DISABLE_CONFIG";
    public static final String OPERATION_ENABLE = "ENABLE_CONFIG";
    public static final String OPERATION_MANUAL_SYNC = "MANUAL_SYNC";

    /** 云平台数据源（sys_user、issue_sync_* 等） */
    public static final String DS_CLOUD = "usky-cloud";

    public static final String MSG_NO_SYNC_DATA =
            "未拉取到待同步数据：请确认云端 sys_user 存在该租户数据，且 poll 认证通过（type=USER 对应表 sys_user）";
    public static final String MSG_POLL_AUTH_FAILED = "云端 poll 认证失败，请检查凭证密钥是否与云端配置一致";
    public static final String PATH_SYNC_DIAGNOSE = "/sync/diagnose";
    public static final String OPERATION_SAVE_TRIGGER = "SAVE_TRIGGER";
}
