package com.atmob.keyboard_android.mvvm.repository

import com.atmob.keyboard_android.util.bridge.FlutterBridgeManager
import com.atmob.keyboard_android.util.bridge.model.base.EmptyResp
import com.atmob.keyboard_android.util.bridge.model.resp.CharacterListResp
import com.atmob.keyboard_android.util.bridge.model.resp.CurrentKeyboardIdResp
import com.atmob.keyboard_android.util.bridge.model.resp.KeyboardListResp
import com.atmob.keyboard_android.util.bridge.model.resp.PrologueListResp

/**
 * 键盘Repository
 */
class KeyboardRepository {
    /**
     * 用户是否已登录
     */
    fun isLogin(
        onSuccess: (resultObj: Boolean) -> Unit,
        onFail: (msg: String) -> Unit
    ) {
        FlutterBridgeManager.isLogin(onSuccess, onFail)
    }

    /**
     * 用户是否为VIP
     */
    fun isMember(
        onSuccess: (resultObj: Boolean) -> Unit,
        onFail: (msg: String) -> Unit
    ) {
        FlutterBridgeManager.isMember(onSuccess, onFail)
    }

    /**
     * 获取键盘列表
     */
    fun getKeyboardList(
        onSuccess: (resultObj: KeyboardListResp) -> Unit,
        onFail: (msg: String) -> Unit
    ) {
        FlutterBridgeManager.getKeyboardList(onSuccess, onFail)
    }

    /**
     * 选择键盘
     */
    fun selectedKeyboard(
        keyboardId: String,
        onSuccess: (resultObj: EmptyResp) -> Unit,
        onFail: (msg: String) -> Unit
    ) {
        FlutterBridgeManager.selectedKeyboard(
            keyboardId,
            onSuccess,
            onFail
        )
    }

    /**
     * 获取当前键盘Id
     */
    fun getCurrentKeyboardId(
        onSuccess: (resultObj: CurrentKeyboardIdResp) -> Unit,
        onFail: (msg: String) -> Unit
    ) {
        FlutterBridgeManager.getCurrentKeyboardId(onSuccess, onFail)
    }

    /**
     * 获取人设列表
     */
    fun getCharacterList(
        keyboardId: String,
        onSuccess: (CharacterListResp) -> Unit,
        onFail: (String) -> Unit
    ) {
        FlutterBridgeManager.getCharacterList(keyboardId, onSuccess, onFail)
    }

    /**
     * 获取开场白列表
     */
    fun getPrologueList(
        onSuccess: (PrologueListResp) -> Unit,
        onFail: (String) -> Unit
    ) {
        FlutterBridgeManager.getPrologueList(onSuccess, onFail)
    }
}