@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "SENSELESS_COMPARISON", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uni.UNIHelloUniAppX
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.unicloud.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlin.properties.Delegates
import io.dcloud.uniapp.extapi.chooseContact as uni_chooseContact
open class GenPagesAPIPhoneContactChooseContact : BasePage {
    constructor(__ins: ComponentInternalInstance, __renderer: String?) : super(__ins, __renderer) {
        onLoad(fun(_: OnLoadOptions) {
            stat_instance.onLoad(this)
        }
        , __ins)
        onPageShow(fun() {
            stat_instance.onShow(this)
        }
        , __ins)
        onPageHide(fun() {
            stat_instance.onHide(this)
        }
        , __ins)
        onUnload(fun() {
            stat_instance.onUnload(this)
        }
        , __ins)
    }
    companion object {
        @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
        var setup: (__props: GenPagesAPIPhoneContactChooseContact) -> Any? = fun(__props): Any? {
            val __ins = getCurrentInstance()!!
            val _ctx = __ins.proxy as GenPagesAPIPhoneContactChooseContact
            val _cache = __ins.renderCache
            val invokeState = ref<String>("尚未调用")
            val displayName = ref<String>("尚未选择联系人")
            val phoneNumber = ref<String>("尚未选择手机号")
            val phoneNumberList = ref<UTSArray<String>>(UTSArray<String>())
            val successText = ref<String>("尚未触发")
            val failText = ref<String>("尚未触发")
            val completeText = ref<String>("尚未触发")
            val logs = ref<UTSArray<String>>(UTSArray<String>())
            fun gen_appendLog_fn(text: String): Unit {
                logs.value.unshift("" + Date.now() + " " + text)
                if (logs.value.length > 10) {
                    logs.value.pop()
                }
            }
            val appendLog = ::gen_appendLog_fn
            fun gen_resetCallbackTexts_fn(): Unit {
                successText.value = "尚未触发"
                failText.value = "尚未触发"
                completeText.value = "尚未触发"
            }
            val resetCallbackTexts = ::gen_resetCallbackTexts_fn
            fun gen_clearResult_fn(): Unit {
                invokeState.value = "尚未调用"
                displayName.value = "尚未选择联系人"
                phoneNumber.value = "尚未选择手机号"
                phoneNumberList.value = UTSArray<String>()
                resetCallbackTexts()
                appendLog("已清空 chooseContact 结果")
            }
            val clearResult = ::gen_clearResult_fn
            fun gen_clearLogs_fn(): Unit {
                logs.value = UTSArray<String>()
            }
            val clearLogs = ::gen_clearLogs_fn
            fun describeComplete(result: Any): String {
                if (result is UniError) {
                    return "" + result.errMsg + " (" + result.errCode + ")"
                }
                val successResult = result as ChooseContactSuccess
                return "" + successResult.errMsg + " / " + successResult.displayName + " / " + successResult.phoneNumber
            }
            fun gen_choosePhoneContact_fn(): Unit {
                invokeState.value = "调用中"
                resetCallbackTexts()
                appendLog("开始调用 chooseContact")
                uni_chooseContact(ChooseContactOptions(success = fun(result: ChooseContactSuccess){
                    invokeState.value = "success"
                    displayName.value = result.displayName
                    phoneNumber.value = result.phoneNumber
                    phoneNumberList.value = result.phoneNumberList
                    successText.value = "" + result.errMsg + " / " + result.displayName + " / " + result.phoneNumber
                    failText.value = "本次未触发"
                    appendLog("chooseContact success " + result.displayName + " " + result.phoneNumber)
                }
                , fail = fun(err: ChooseContactFail){
                    invokeState.value = "fail"
                    failText.value = "" + err.errMsg + " (" + err.errCode + ")"
                    appendLog("chooseContact fail " + err.errMsg)
                }
                , complete = fun(result: ChooseContactComplete){
                    completeText.value = describeComplete(result)
                    appendLog("chooseContact complete " + completeText.value)
                }
                ))
            }
            val choosePhoneContact = ::gen_choosePhoneContact_fn
            return fun(): Any? {
                return _cE("scroll-view", _uM("style" to _nS(_uM("flex" to "1", "padding" to "6px"))), _uA(
                    _cE("text", _uM("class" to "uni-h2"), "联系人选择 uni.chooseContact"),
                    _cE("text", null, "调用系统的联系人选择界面"),
                    _cE("text", _uM("class" to "uni-h3"), "快捷操作"),
                    _cE("text", _uM("class" to "margin-v"), "调用状态：" + _tD(unref(invokeState)), 1),
                    _cE("button", _uM("class" to "margin-v", "onClick" to choosePhoneContact), "选择联系人"),
                    _cE("button", _uM("class" to "margin-v", "onClick" to clearResult), "清空结果"),
                    _cE("button", _uM("class" to "margin-v", "onClick" to clearLogs), "清空日志"),
                    _cE("text", _uM("class" to "uni-h3"), "选择结果"),
                    _cE("text", _uM("class" to "field-label"), "displayName"),
                    _cE("text", _uM("class" to "log-text"), _tD(unref(displayName)), 1),
                    _cE("text", _uM("class" to "field-label"), "phoneNumber"),
                    _cE("text", _uM("class" to "log-text"), _tD(unref(phoneNumber)), 1),
                    _cE("text", _uM("class" to "field-label"), "phoneNumberList（" + _tD(unref(phoneNumberList).length) + "）", 1),
                    if (unref(phoneNumberList).length > 0) {
                        _cE("view", _uM("key" to 0, "class" to "log-list"), _uA(
                            _cE(Fragment, null, RenderHelpers.renderList(unref(phoneNumberList), fun(item, __key, __index, _cached): Any {
                                return _cE("text", _uM("class" to "log-item", "key" to item), _tD(item), 1)
                            }), 128)
                        ))
                    } else {
                        _cE("text", _uM("key" to 1, "class" to "log-text"), "尚未返回手机号列表")
                    }
                    ,
                    _cE("text", _uM("class" to "uni-h3"), "回调信息"),
                    _cE("text", _uM("class" to "margin-v"), "success：" + _tD(unref(successText)), 1),
                    _cE("text", _uM("class" to "margin-v"), "fail：" + _tD(unref(failText)), 1),
                    _cE("text", _uM("class" to "margin-v"), "complete：" + _tD(unref(completeText)), 1),
                    _cE("text", _uM("class" to "uni-h3"), "最近日志"),
                    if (unref(logs).length > 0) {
                        _cE("view", _uM("key" to 2, "class" to "log-list"), _uA(
                            _cE(Fragment, null, RenderHelpers.renderList(unref(logs), fun(item, __key, __index, _cached): Any {
                                return _cE("text", _uM("class" to "log-item", "key" to item), _tD(item), 1)
                            }), 128)
                        ))
                    } else {
                        _cE("text", _uM("key" to 3, "class" to "log-text"), "暂无日志")
                    }
                ), 4)
            }
        }
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            _nCS(_uA(
                styles0
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return _uM("margin-v" to _pS(_uM("marginTop" to 5, "marginRight" to 0, "marginBottom" to 5, "marginLeft" to 0)), "field-label" to _pS(_uM("marginTop" to 6, "fontSize" to 14)), "log-text" to _pS(_uM("marginTop" to 5, "marginRight" to 0, "marginBottom" to 5, "marginLeft" to 0, "paddingTop" to 10, "paddingRight" to 10, "paddingBottom" to 10, "paddingLeft" to 10, "fontSize" to 14, "borderTopWidth" to 1, "borderRightWidth" to 1, "borderBottomWidth" to 1, "borderLeftWidth" to 1, "borderTopStyle" to "solid", "borderRightStyle" to "solid", "borderBottomStyle" to "solid", "borderLeftStyle" to "solid", "borderTopColor" to "#cccccc", "borderRightColor" to "#cccccc", "borderBottomColor" to "#cccccc", "borderLeftColor" to "#cccccc")), "log-list" to _pS(_uM("marginTop" to 5, "marginRight" to 0, "marginBottom" to 5, "marginLeft" to 0, "paddingTop" to 10, "paddingRight" to 10, "paddingBottom" to 10, "paddingLeft" to 10, "borderTopWidth" to 1, "borderRightWidth" to 1, "borderBottomWidth" to 1, "borderLeftWidth" to 1, "borderTopStyle" to "solid", "borderRightStyle" to "solid", "borderBottomStyle" to "solid", "borderLeftStyle" to "solid", "borderTopColor" to "#cccccc", "borderRightColor" to "#cccccc", "borderBottomColor" to "#cccccc", "borderLeftColor" to "#cccccc", "display" to "flex", "flexDirection" to "column")), "log-item" to _pS(_uM("fontSize" to 14, "marginTop" to 4, "marginRight" to 0, "marginBottom" to 4, "marginLeft" to 0)))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = _uM()
        var emits: Map<String, Any?> = _uM()
        var props = _nP(_uM())
        var propsNeedCastKeys: UTSArray<String> = _uA()
        var components: Map<String, CreateVueComponent> = _uM()
    }
}
