@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.chooseImage as uni_chooseImage
import io.dcloud.uniapp.extapi.hideLoading as uni_hideLoading
import io.dcloud.uniapp.extapi.share as uni_share
import io.dcloud.uniapp.extapi.showLoading as uni_showLoading
import io.dcloud.uniapp.extapi.showToast as uni_showToast
open class GenPagesAPIUniShareUniShare : 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: GenPagesAPIUniShareUniShare) -> Any? = fun(__props): Any? {
            val __ins = getCurrentInstance()!!
            val _ctx = __ins.proxy as GenPagesAPIUniShareUniShare
            val _cache = __ins.renderCache
            val scene = ref("WXSceneSession")
            val type = ref(0)
            val typeChange = fun(e: UniRadioGroupChangeEvent){
                type.value = parseInt(e.detail.value)
            }
            val sceneChange = fun(e: UniRadioGroupChangeEvent){
                scene.value = e.detail.value
            }
            val title = ref("share")
            val shareContent = ref("uni-app x 可以分享内容到微信了！")
            val imageURL = ref<String?>(null)
            fun gen_chooseImage_fn() {
                uni_chooseImage(ChooseImageOptions(count = 1, success = fun(res){
                    imageURL.value = res.tempFilePaths[0]
                }
                , fail = fun(err){
                    console.log("err: ", JSON.stringify(err))
                    uni_showToast(ShowToastOptions(title = "choose image error.code:" + err.errCode + ";message:" + err.errMsg, position = "bottom"))
                }
                ))
            }
            val chooseImage = ::gen_chooseImage_fn
            fun gen_share_fn() {
                uni_showLoading(ShowLoadingOptions(title = "正在分享......"))
                console.log("scene.value: ", scene.value)
                uni_share(ShareOptions(provider = "weixin", title = "微信分享", scene = scene.value, type = type.value, href = "https://uniapp.dcloud.net.cn/api/plugins/share.html", summary = shareContent.value, imageUrl = imageURL.value, success = fun(res) {
                    uni_hideLoading(null)
                    uni_showToast(ShowToastOptions(title = "分享成功"))
                }
                , fail = fun(e) {
                    uni_hideLoading(null)
                    uni_showToast(ShowToastOptions(title = e.errMsg))
                }
                ))
            }
            val share = ::gen_share_fn
            return fun(): Any? {
                val _component_page_head = resolveEasyComponent("page-head", GenComponentsPageHeadPageHeadClass)
                val _component_radio = resolveComponent("radio")
                val _component_radio_group = resolveComponent("radio-group")
                return _cE("scroll-view", _uM("style" to _nS(_uM("flex" to "1"))), _uA(
                    _cV(_component_page_head, _uM("title" to unref(title)), null, 8, _uA(
                        "title"
                    )),
                    _cE("view", _uM("class" to "uni-list-cell-padding status-box"), _uA(
                        _cE("view", _uM("class" to "uni-title uni-common-mt"), _uA(
                            _cE("text", _uM("class" to "uni-title-text"), "分享内容：")
                        )),
                        _cE("textarea", _uM("style" to _nS(_uM("max-height" to "100px", "padding" to "10px", "background-color" to "aliceblue", "border" to "1px solid black")), "auto-height" to true, "value" to unref(shareContent)), null, 12, _uA(
                            "value"
                        ))
                    )),
                    _cE("view", _uM("class" to "uni-list-cell-padding status-box"), _uA(
                        _cE("view", _uM("class" to "uni-title uni-common-mt"), _uA(
                            _cE("text", _uM("class" to "uni-title-text"), "分享图片：")
                        )),
                        _cE("view", _uM("style" to _nS(_uM("flex-wrap" to "wrap"))), _uA(
                            if (unref(imageURL) != null) {
                                _cE("image", _uM("key" to 0, "style" to _nS(_uM("width" to "104px", "height" to "104px")), "src" to unref(imageURL)), null, 12, _uA(
                                    "src"
                                ))
                            } else {
                                _cE("image", _uM("key" to 1, "class" to "uni-uploader__input-box", "onClick" to chooseImage, "src" to "/static/plus.png"))
                            }
                        ), 4)
                    )),
                    _cE("view", _uM("class" to "uni-list-cell-padding status-box"), _uA(
                        _cE("view", _uM("class" to "uni-title uni-common-mt"), _uA(
                            _cE("text", _uM("class" to "uni-title-text"), "分享类型：")
                        )),
                        _cV(_component_radio_group, _uM("class" to "uni-flex", "onChange" to typeChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                            return _uA(
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "0", "checked" to true), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        " 图文 "
                                    )
                                }
                                ), "_" to 1)),
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "1"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        "纯文字"
                                    )
                                }
                                ), "_" to 1)),
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "2"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        "纯图片"
                                    )
                                }
                                ), "_" to 1))
                            )
                        }
                        ), "_" to 1))
                    )),
                    _cE("view", _uM("class" to "uni-list-cell-padding status-box"), _uA(
                        _cE("view", _uM("class" to "uni-title uni-common-mt"), _uA(
                            _cE("text", _uM("class" to "uni-title-text"), "分享到：")
                        )),
                        _cV(_component_radio_group, _uM("class" to "uni-flex", "style" to _nS(_uM("flex-wrap" to "wrap")), "onChange" to sceneChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                            return _uA(
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "WXSceneSession", "checked" to true), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        " 聊天界面 "
                                    )
                                }
                                ), "_" to 1)),
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "WXSceneTimeline"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        "朋友圈"
                                    )
                                }
                                ), "_" to 1)),
                                _cV(_component_radio, _uM("class" to "uni-common-mt", "value" to "WXSceneFavorite", "disabled" to true, "style" to _nS(_uM("color" to "gray"))), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        "微信收藏（暂不支持）"
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "style"
                                ))
                            )
                        }
                        ), "_" to 1), 8, _uA(
                            "style"
                        ))
                    )),
                    _cE("view", _uM("class" to "uni-padding-wrap uni-common-mt"), _uA(
                        _cE("button", _uM("type" to "primary", "onClick" to share), "分享")
                    ))
                ), 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("uni-uploader__input-box" to _pS(_uM("marginTop" to 5, "marginRight" to 5, "marginBottom" to 5, "marginLeft" to 5, "width" to 104, "height" to 104, "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 "#D9D9D9", "borderRightColor" to "#D9D9D9", "borderBottomColor" to "#D9D9D9", "borderLeftColor" to "#D9D9D9")), "status-box" to _pS(_uM("backgroundColor" to "#FFFFFF", "marginTop" to 0, "marginRight" to 20, "marginBottom" to 0, "marginLeft" to 20)))
            }
        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()
    }
}
