package com.base.scanqrclear.ui.whatsappqr

import android.content.Intent
import androidx.core.widget.addTextChangedListener
import com.base.scanqrclear.R
import com.base.scanqrclear.base.BaseActivity
import com.base.scanqrclear.bean.AreaCodeBean
import com.base.scanqrclear.databinding.ActivityAreaCodeBinding

class AreaCodeActivity : BaseActivity<ActivityAreaCodeBinding>(ActivityAreaCodeBinding::inflate) {

    override fun initView() {
        super.initView()

        val list = listOf(
            AreaCodeBean(1, "Canada"),
            AreaCodeBean(1, "United States of America"),
            AreaCodeBean(7, "Russia"),
            AreaCodeBean(20, "Egypt"),
            AreaCodeBean(27, "South Africa"),
            AreaCodeBean(30, "Greece"),
            AreaCodeBean(31, "Netherlands"),
            AreaCodeBean(32, "Belgium"),
            AreaCodeBean(33, "France"),
            AreaCodeBean(34, "Spain"),
            AreaCodeBean(36, "Hungary"),
            AreaCodeBean(39, "Italy"),
            AreaCodeBean(40, "Romania"),
            AreaCodeBean(41, "Switzerland"),
            AreaCodeBean(43, "Austria"),
            AreaCodeBean(44, "United Kingdom"),
            AreaCodeBean(45, "Denmark"),
            AreaCodeBean(46, "Sweden"),
            AreaCodeBean(47, "Norway"),
            AreaCodeBean(48, "Poland"),
            AreaCodeBean(49, "Germany"),
            AreaCodeBean(51, "Peru"),
            AreaCodeBean(52, "Mexico"),
            AreaCodeBean(53, "Cuba"),
            AreaCodeBean(54, "Argentina"),
            AreaCodeBean(55, "Brazil"),
            AreaCodeBean(56, "Chile"),
            AreaCodeBean(57, "Colombia"),
            AreaCodeBean(60, "Malaysia"),
            AreaCodeBean(61, "Australia"),
            AreaCodeBean(62, "Indonesia"),
            AreaCodeBean(63, "Philippines"),
            AreaCodeBean(64, "New Zealand"),
            AreaCodeBean(65, "Singapore"),
            AreaCodeBean(66, "Thailand"),
            AreaCodeBean(81, "Japan"),
            AreaCodeBean(82, "South Korea"),
            AreaCodeBean(84, "Vietnam"),
            AreaCodeBean(86, "China"),
            AreaCodeBean(90, "Turkey"),
            AreaCodeBean(91, "India"),
            AreaCodeBean(92, "Pakistan"),
            AreaCodeBean(93, "Afghanistan"),
            AreaCodeBean(94, "Sri Lanka"),
            AreaCodeBean(95, "Myanmar"),
            AreaCodeBean(98, "Iran"),

            AreaCodeBean(210, "São Tomé and Príncipe"), // 圣多美和普林西比
            AreaCodeBean(211, "South Sudan"), // 南苏丹
            AreaCodeBean(212, "Morocco"), // 摩洛哥
            AreaCodeBean(213, "Algeria"), // 阿尔及利亚
            AreaCodeBean(216, "Tunisia"), // 突尼斯
            AreaCodeBean(218, "Libya"), // 利比亚
            AreaCodeBean(220, "The Gambia"), // 冈比亚
            AreaCodeBean(221, "Senegal"), // 塞内加尔
            AreaCodeBean(222, "Mauritania"), // 毛里塔尼亚
            AreaCodeBean(223, "Mali"), // 马里
            AreaCodeBean(224, "Guinea"), // 几内亚
            AreaCodeBean(225, "Ivory Coast"), // 科特迪瓦
            AreaCodeBean(226, "Burkina Faso"), // 布基纳法索
            AreaCodeBean(227, "Niger"), // 尼日尔
            AreaCodeBean(228, "Togo"), // 多哥
            AreaCodeBean(229, "Benin"), // 贝宁
            AreaCodeBean(230, "Mauritius"), // 毛里求斯
            AreaCodeBean(231, "Liberia"), // 利比里亚
            AreaCodeBean(232, "Sierra Leone"), // 塞拉利昂
            AreaCodeBean(233, "Ghana"), // 加纳
            AreaCodeBean(234, "Nigeria"), // 尼日利亚
            AreaCodeBean(235, "Chad"), //乍得
            AreaCodeBean(236, "Central African Republic"), // 中非共和国
            AreaCodeBean(237, "Cameroon"), // 喀麦隆
            AreaCodeBean(238, "Cape Verde"), // 佛得角
            AreaCodeBean(239, "São Tomé and Príncipe"), // 圣多美和普林西比
            AreaCodeBean(240, "Equatorial Guinea"), // 赤道几内亚
            AreaCodeBean(241, "Gabon"), // 加蓬
            AreaCodeBean(242, "Congo (Brazzaville)"), // 刚果（布）
            AreaCodeBean(243, "Congo (Kinshasa)"), // 刚果（金）
            AreaCodeBean(244, "Angola"), // 安哥拉
            AreaCodeBean(245, "Guinea-Bissau"), // 几内亚比绍
            AreaCodeBean(246, "British Indian Ocean Territory"), // 英属印度洋领地
            AreaCodeBean(247, "Ascension Island"), // 圣诞岛
            AreaCodeBean(248, "Seychelles"), // 塞舌尔
            AreaCodeBean(249, "Sudan"), // 苏丹
            AreaCodeBean(250, "Rwanda"), // 卢旺达
            AreaCodeBean(251, "Ethiopia"), // 埃塞俄比亚
            AreaCodeBean(252, "Somalia"), // 索马里
            AreaCodeBean(253, "Djibouti"), // 吉布提
            AreaCodeBean(254, "Kenya"), // 肯尼亚
            AreaCodeBean(255, "Tanzania"), // 坦桑尼亚
            AreaCodeBean(256, "Uganda"), // 乌干达
            AreaCodeBean(257, "Burundi"), // 布隆迪
            AreaCodeBean(258, "Mozambique"), // 莫桑比克
            AreaCodeBean(260, "Zambia"), // 赞比亚
            AreaCodeBean(261, "Madagascar"), // 马达加斯加
            AreaCodeBean(262, "Réunion"), // 留尼汪
            AreaCodeBean(263, "Zimbabwe"), // 津巴布韦
            AreaCodeBean(264, "Namibia"), // 纳米比亚
            AreaCodeBean(265, "Malawi"), // 马拉维
            AreaCodeBean(266, "Lesotho"), // 莱索托
            AreaCodeBean(267, "Botswana"), // 博茨瓦纳
//            AreaCodeBean(268, "Eswatini"), // 埃斯瓦蒂尼
//            AreaCodeBean(269, "Comoros"), // 科摩罗
//            AreaCodeBean(290, "Saint Helena"), // 圣赫勒拿
//            AreaCodeBean(291, "Eritrea"), // 厄立特里亚
//            AreaCodeBean(297, "Aruba"), // 阿鲁巴
//            AreaCodeBean(298, "Faroe Islands"), // 法罗群岛
//            AreaCodeBean(299, "Greenland"), // 格陵兰


//            AreaCodeBean(300, "Cyprus"),
//            AreaCodeBean(327, "Kazakhstan"),
            AreaCodeBean(350, "Gibraltar"),
            AreaCodeBean(351, "Portugal"),
            AreaCodeBean(352, "Luxembourg"),
            AreaCodeBean(353, "Ireland"),
            AreaCodeBean(354, "Iceland"),
            AreaCodeBean(355, "Albania"),
            AreaCodeBean(356, "Malta"),
            AreaCodeBean(357, "Cyprus"),
            AreaCodeBean(358, "Finland"),
            AreaCodeBean(359, "Bulgaria"),
            AreaCodeBean(370, "Lithuania"),
            AreaCodeBean(371, "Latvia"),
            AreaCodeBean(372, "Estonia"),
            AreaCodeBean(373, "Moldova"),
            AreaCodeBean(374, "Armenia"),
            AreaCodeBean(375, "Belarus"),
            AreaCodeBean(376, "Andorra"),
            AreaCodeBean(377, "Monaco"),
            AreaCodeBean(378, "San Marino"),
            AreaCodeBean(380, "Ukraine"),
            AreaCodeBean(381, "Serbia"),
            AreaCodeBean(382, "Montenegro"),
//            AreaCodeBean(383, "Kosovo"),
//            AreaCodeBean(385, "Croatia"),
            AreaCodeBean(386, "Slovenia"),
//            AreaCodeBean(387, "Bosnia and Herzegovina"),
//            AreaCodeBean(389, "North Macedonia"),


            AreaCodeBean(420, "Czech Republic"),
            AreaCodeBean(421, "Slovakia"),
            AreaCodeBean(423, "Liechtenstein"),

//            AreaCodeBean(500, "Falkland Islands"),
            AreaCodeBean(501, "Belize"),
            AreaCodeBean(502, "Guatemala"),
            AreaCodeBean(503, "El Salvador"),
            AreaCodeBean(504, "Honduras"),
            AreaCodeBean(505, "Nicaragua"),
            AreaCodeBean(506, "Costa Rica"),
            AreaCodeBean(507, "Panama"),
//            AreaCodeBean(508, "Saint Pierre and Miquelon"),
            AreaCodeBean(509, "Haiti"),
//            AreaCodeBean(590, "Guadeloupe"),
            AreaCodeBean(591, "Bolivia"),
            AreaCodeBean(592, "Guyana"),
            AreaCodeBean(593, "Ecuador"),
            AreaCodeBean(594, "French Guiana"),
            AreaCodeBean(595, "Paraguay"),
            AreaCodeBean(596, "Martinique"),
            AreaCodeBean(597, "Suriname"),
            AreaCodeBean(598, "Uruguay"),

//            AreaCodeBean(670, "Timor-Leste"),
//            AreaCodeBean(672, "Antarctica"),
            AreaCodeBean(673, "Brunei"),
            AreaCodeBean(674, "Nauru"),
            AreaCodeBean(675, "Papua New Guinea"),
            AreaCodeBean(676, "Tonga"),
            AreaCodeBean(677, "Solomon Islands"),
            AreaCodeBean(678, "Vanuatu"),
            AreaCodeBean(679, "Fiji"),
//            AreaCodeBean(680, "Palau"),
//            AreaCodeBean(681, "Wallis and Futuna"),
            AreaCodeBean(682, "Cook Islands"),
//            AreaCodeBean(683, "Niue"),
            AreaCodeBean(684, "American Samoa"),
            AreaCodeBean(685, "Samoa"),
            AreaCodeBean(686, "Kiribati"),
            AreaCodeBean(687, "New Caledonia"),
            AreaCodeBean(688, "Tuvalu"),
            AreaCodeBean(689, "French Polynesia"),
            AreaCodeBean(690, "Tokelau"),
//            AreaCodeBean(691, "Federated States of Micronesia"),
//            AreaCodeBean(692, "Marshall Islands"),

            AreaCodeBean(850, "North Korea"), // 朝鲜
            AreaCodeBean(852, "Hong Kong"), // 香港
            AreaCodeBean(853, "Macau"), // 澳门
            AreaCodeBean(855, "Cambodia"), // 柬埔寨
            AreaCodeBean(856, "Laos"), // 老挝
            AreaCodeBean(880, "Bangladesh"), // 孟加拉国
            AreaCodeBean(886, "Taiwan"), // 台湾地区


            AreaCodeBean(960, "Maldives"),
            AreaCodeBean(961, "Lebanon"),
            AreaCodeBean(962, "Jordan"),
            AreaCodeBean(963, "Syria"),
            AreaCodeBean(964, "Iraq"),
            AreaCodeBean(965, "Kuwait"),
            AreaCodeBean(966, "Saudi Arabia"),
            AreaCodeBean(967, "Yemen"),
            AreaCodeBean(968, "Oman"),
            AreaCodeBean(971, "United Arab Emirates"),
            AreaCodeBean(972, "Israel"),
            AreaCodeBean(973, "Bahrain"),
            AreaCodeBean(974, "Qatar"),
//            AreaCodeBean(975, "Bhutan"),
            AreaCodeBean(976, "Mongolia"),
            AreaCodeBean(977, "Nepal"),
            AreaCodeBean(992, "Tajikistan"),
            AreaCodeBean(993, "Turkmenistan"),
            AreaCodeBean(994, "Azerbaijan"),
            AreaCodeBean(995, "Georgia"),


            AreaCodeBean(1242, "The Bahamas"),          // 巴哈马
            AreaCodeBean(1246, "Barbados"),             // 巴巴多斯
            AreaCodeBean(1264, "Anguilla"),             // 安圭拉
            AreaCodeBean(1268, "Antigua and Barbuda"), // 安提瓜和巴布达
            AreaCodeBean(1345, "Cayman IS"),       // 开曼群岛
            AreaCodeBean(1441, "Bermuda IS"),              // 百慕大
            AreaCodeBean(1664, "Montserrat IS"),           // 蒙特塞拉特
            AreaCodeBean(1670, "Mariana Is"), // 北马里亚纳群岛
            AreaCodeBean(1671, "Guam"),                 // 关岛
            AreaCodeBean(1758, "St.Lucia"),          // 圣卢西亚
            AreaCodeBean(1784, "Saint Vincent"), // 圣文森特和格林纳丁斯
            AreaCodeBean(1787, "Puerto Rico"),          // 波多黎各
            AreaCodeBean(1876, "Jamaica"),              // 牙买加
        )

        val adapter = AreCodeAdapter()
        adapter.itemClick = { item ->

            setResult(item.code, Intent())
            finish()

            overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right);

        }
        binding.rv.adapter = adapter
        adapter.submitList(list)
    }

    override fun initListener() {
        super.initListener()

        binding.edit.addTextChangedListener {

        }
    }

}