package com.swoosh.microblog.data

import android.content.Context

/**
 * Legacy compatibility wrapper. Now delegates to AccountManager.
 * Kept for backward compatibility during migration.
 */
class CredentialsManager(context: Context) {

    private val accountManager = AccountManager(context)

    var ghostUrl: String?
        get() = accountManager.getActiveAccount()?.blogUrl
        set(_) {
            // No-op: use AccountManager directly for mutations
        }

    var adminApiKey: String?
        get() = accountManager.getActiveAccount()?.apiKey
        set(_) {
            // No-op: use AccountManager directly for mutations
        }

    val isConfigured: Boolean
        get() = accountManager.isConfigured

    fun clear() {
        val activeAccount = accountManager.getActiveAccount()
        if (activeAccount != null) {
            accountManager.removeAccount(activeAccount.id)
        }
    }
}
