package com.za.ui.servicing.order_confirm

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import coil.compose.AsyncImage
import com.blankj.utilcode.util.FileUtils
import com.blankj.utilcode.util.TimeUtils
import com.blankj.utilcode.util.ToastUtils
import com.za.base.Const
import com.za.base.theme.black10
import com.za.base.theme.black65
import com.za.base.theme.buttonBgColor
import com.za.base.theme.headBgColor
import com.za.base.view.CommonButton
import com.za.base.view.CommonDialog
import com.za.base.view.HeadView
import com.za.bean.db.ele.EleCarDamagePhotoBean
import com.za.bean.db.ele.EleWorkOrderBean
import com.za.common.GlobalData
import com.za.common.util.AppFileManager
import com.za.common.util.ServicingSpeechManager
import com.za.ext.finish
import com.za.ext.goNextPage
import com.za.servicing.R
import com.za.ui.view.SignatureView
import java.io.File
import kotlin.math.ceil

@Preview
@Composable
fun ConfirmEleScreen(vm : ConfirmEleVm = viewModel()) {
	val context = LocalContext.current
	val uiState = vm.uiState.collectAsStateWithLifecycle()
	LaunchedEffect(key1 = Unit) {
		vm.dispatch(ConfirmEleVm.Action.Init)
		if (GlobalData.currentOrder?.flowType == Const.TUO_CHE) {
			ServicingSpeechManager.playOrderAcceptSign(context)
		} else {
			ServicingSpeechManager.playCarOwnerSign(context)
		}
	}

	if (uiState.value.goNextPage != null) {
		goNextPage(uiState.value.goNextPage?.nextState, context)
	}

	if (uiState.value.isGoNextPageDialog == true) {
		CommonDialog(cancelText = "取消",
			confirmText = "前往下一步",
			title = "是否前往下一步？",
			cancelEnable = true,
			cancel = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
			},
			dismiss = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
			},
			confirm = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(isGoNextPageDialog = false)))
				vm.dispatch(ConfirmEleVm.Action.Upload)
			})
	}

	//离线操作框
	if (uiState.value.showOfflineDialog == true) {
		CommonDialog(cancelText = "取消",
			confirmText = "离线上传",
			title = "上传失败，是否进行离线提交？",
			cancelEnable = true,
			cancel = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
			},
			dismiss = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
			},
			confirm = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
				vm.dispatch(ConfirmEleVm.Action.UploadOffline)
			})
	}

	if (uiState.value.showServicePeopleSignDialog == true) {
		CommonDialog(cancelText = "取消",
			confirmText = "保存",
			title = "是否将签名保存，以后的工单中默认使用此签名",
			cancelEnable = true,
			cancel = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
					showServicePeopleSignDialog = false)))
			},
			dismiss = {
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
					showServicePeopleSignDialog = false)))
			},
			confirm = {
				if (uiState.value.eleWorkOrderBean?.localServicePeopleSignPath.isNullOrEmpty()) {
					ToastUtils.showShort("请先进行签名")
					vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
						showServicePeopleSignDialog = false)))
					return@CommonDialog
				}
				File(uiState.value.eleWorkOrderBean?.localServicePeopleSignPath ?: "").copyTo(File(
					AppFileManager.getDriverSignPath(context)), true)
				vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
					showServicePeopleSignDialog = false)))
			})
	}


	Scaffold(topBar = {
		HeadView(title = "客户签字", onBack = { context.finish() })
	}) { paddingValues ->
		LazyColumn(modifier = Modifier
			.fillMaxSize()
			.padding(paddingValues)
			.background(Color(0xFFF5F5F5)), verticalArrangement = Arrangement.spacedBy(12.dp)) {

			item {
				EleWorkOrderDetailView(flowType = uiState.value.orderInfo?.flowType,
					eleWorkOrderBean = uiState.value.eleWorkOrderBean,
					damagePhoto = uiState.value.damagePhoto)
			}

			item {
				if (uiState.value.orderInfo?.flowType != Const.TUO_CHE) {
					Column(modifier = Modifier
						.fillMaxWidth()
						.background(Color.White)
						.padding(horizontal = 16.dp)) {
						Row(verticalAlignment = Alignment.CenterVertically) {
							Text(text = "*",
								fontWeight = FontWeight.Bold,
								color = Color.Red,
								fontSize = 15.sp)
							Spacer(modifier = Modifier.width(8.dp))
							Text(text = "服务是否成功",
								fontWeight = FontWeight.Medium,
								color = Color.Black,
								fontSize = 15.sp)

							Spacer(modifier = Modifier.width(15.dp))
							ConfirmEleCheckBoxItem(modifier = Modifier.fillMaxWidth(),
								confirmText = "成功",
								cancelText = "失败",
								confirmValue = uiState.value.eleWorkOrderBean?.isSuccess == 1,
								cancelValue = uiState.value.eleWorkOrderBean?.isSuccess == 2,
								confirmCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.UpdateServiceSuccessState(1))
								},
								cancelCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.UpdateServiceSuccessState(2))
								})
						}

						HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp),
							color = black10)
					}
				}

				//是否拥有更换电瓶的能力
				if (uiState.value.orderInfo?.flowType == Const.SMALL_REPAIR && uiState.value.orderInfo?.hasReplaceBatteryCapable == 1) {

					Column(modifier = Modifier
						.fillMaxWidth()
						.background(Color.White)
						.padding(horizontal = 16.dp)) {
						Row(verticalAlignment = Alignment.CenterVertically) {
							Text(text = "*",
								fontWeight = FontWeight.Bold,
								color = Color.Red,
								fontSize = 15.sp)
							Spacer(modifier = Modifier.width(8.dp))
							Text(text = "是否更换电瓶",
								fontWeight = FontWeight.Medium,
								color = Color.Black,
								fontSize = 15.sp)

							Spacer(modifier = Modifier.width(15.dp))
							ConfirmEleCheckBoxItem(modifier = Modifier.fillMaxWidth(),
								confirmText = "更换",
								cancelText = "不更换",
								confirmValue = uiState.value.eleWorkOrderBean?.changeBattery == true,
								cancelValue = uiState.value.eleWorkOrderBean?.changeBattery == false,
								confirmCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.IsChangeBattery(true))
								},
								cancelCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.IsChangeBattery(false))
								})

						}
						HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp),
							color = black10)
					}
				}

				if (uiState.value.orderInfo?.flowType == Const.TUO_CHE) {
					Column(modifier = Modifier
						.fillMaxWidth()
						.height(86.dp)
						.background(Color.White)
						.padding(horizontal = 16.dp)) {
						Spacer(modifier = Modifier.height(10.dp))
						Row(verticalAlignment = Alignment.CenterVertically,
							modifier = Modifier.fillMaxHeight().fillMaxWidth()) {
							Text(text = "*",
								fontWeight = FontWeight.Bold,
								color = Color.Red,
								fontSize = 15.sp)
							Spacer(modifier = Modifier.width(8.dp))
							Text(text = "是否加小轮",
								fontWeight = FontWeight.Medium,
								color = Color.Black,
								fontSize = 15.sp)

							Spacer(modifier = Modifier.width(5.dp))
							ConfirmEleCheckBoxItem(confirmText = "是",
								cancelText = "否",
								confirmValue = uiState.value.isAddSmallWheel == true,
								cancelValue = uiState.value.isAddSmallWheel == false,
								confirmCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
										isAddSmallWheel = true)))
								},
								cancelCheckedChange = {
									vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
										isAddSmallWheel = false)))
								})

							AnimatedVisibility(uiState.value.isAddSmallWheel == true,
								modifier = Modifier.fillMaxWidth()) {
								OutlinedTextField(
									value = "${uiState.value.wheelNum ?: ""}",
									onValueChange = { wheel ->
										if ((wheel.toIntOrNull() ?: 0) > 4) {
											ToastUtils.showShort("小轮个数不能超过4个")
											return@OutlinedTextField
										}
										vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
											wheelNum = wheel.toIntOrNull())))
									},
									label = { Text("小轮个数", fontSize = 10.sp) },
									modifier = Modifier
										.fillMaxWidth()
										.height(67.dp),
									maxLines = 1,
									keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
									textStyle = TextStyle.Default.copy(fontSize = 16.sp,
										color = Color.Black),
									shape = RoundedCornerShape(6.dp),
									colors = OutlinedTextFieldDefaults.colors(focusedBorderColor = headBgColor,
										unfocusedBorderColor = Color.Gray.copy(alpha = 0.5f),
										focusedLabelColor = headBgColor,
										unfocusedLabelColor = Color.Gray),
								)
							}
						}
					}
				}

				Box(modifier = Modifier
					.fillMaxWidth()
					.background(Color.White)
					.padding(horizontal = 16.dp, vertical = 10.dp)) {
					Row(verticalAlignment = Alignment.CenterVertically,
						modifier = Modifier.fillMaxWidth()) {
						AsyncImage(model = R.drawable.sv_star,
							contentDescription = "",
							modifier = Modifier.size(16.dp))
						Spacer(modifier = Modifier.width(8.dp))
						Text(text = "本人对服务完成无异议，同意救援服务商获取合理施救费用。",
							maxLines = 1,
							color = Color(0xFFD32F2F),
							fontWeight = FontWeight.Medium,
							fontSize = 14.sp,
							modifier = Modifier
								.weight(1f)
								.basicMarquee())
					}
				}

				Spacer(modifier = Modifier.height(12.dp))

				Column(modifier = Modifier
					.fillMaxWidth()
					.background(Color.White)
					.padding(horizontal = 16.dp, vertical = 10.dp)) {
					Row(modifier = Modifier.fillMaxWidth(),
						horizontalArrangement = Arrangement.SpaceAround) {
						Column(modifier = Modifier
							.weight(1f)
							.padding(horizontal = 8.dp),
							horizontalAlignment = Alignment.CenterHorizontally,
							verticalArrangement = Arrangement.Center) {
							Row(verticalAlignment = Alignment.CenterVertically,
								modifier = Modifier.padding(bottom = 8.dp)) {
								Text(text = "接车人签字:".takeIf { uiState.value.orderInfo?.flowType == Const.TUO_CHE }
									?: "车主签字:",
									color = Color.Black,
									fontWeight = FontWeight.Medium,
									fontSize = 14.sp)
								Text(text = "（正楷）",
									color = Color(0xFFD32F2F),
									fontWeight = FontWeight.Medium,
									fontSize = 12.sp,
									modifier = Modifier.padding(start = 4.dp))
							}
							Box(modifier = Modifier
								.fillMaxWidth()
								.border(width = 1.dp,
									color = Color(0xFFE0E0E0),
									shape = RoundedCornerShape(8.dp))
								.padding(8.dp)) {
								SignatureView(success = {
									if (it.isNullOrBlank()) {
										ToastUtils.showLong("签名合成失败")
										return@SignatureView
									}
									vm.dispatch(ConfirmEleVm.Action.UpdateAcceptSignature(it))
								},
									serverPath = uiState.value.eleWorkOrderBean?.serverAcceptCarSignPath
										?: uiState.value.eleWorkOrderBean?.localAcceptCarSignPath)
							}
						}

						Column(modifier = Modifier
							.weight(1f)
							.padding(horizontal = 8.dp),
							horizontalAlignment = Alignment.CenterHorizontally,
							verticalArrangement = Arrangement.Center) {
							Row(verticalAlignment = Alignment.CenterVertically,
								modifier = Modifier.padding(bottom = 8.dp)) {
								Text(text = "服务人员签字:",
									color = Color.Black,
									fontWeight = FontWeight.Medium,
									fontSize = 14.sp)
								Text(text = "（正楷）",
									color = Color(0xFFD32F2F),
									fontWeight = FontWeight.Medium,
									fontSize = 12.sp,
									modifier = Modifier.padding(start = 4.dp))
							}
							Box(modifier = Modifier
								.fillMaxWidth()
								.border(width = 1.dp,
									color = Color(0xFFE0E0E0),
									shape = RoundedCornerShape(8.dp))
								.padding(8.dp)) {
								SignatureView(success = {
									if (it.isNullOrBlank()) {
										ToastUtils.showLong("签名合成失败")
										return@SignatureView
									}
									vm.dispatch(ConfirmEleVm.Action.UploadServiceSignature(it))

									if (! FileUtils.isFileExists(File(AppFileManager.getDriverSignPath(
											context)))
									) {
										vm.updateState(uiState.value.copy(
											showServicePeopleSignDialog = true))
									}
								},
									serverPath = uiState.value.eleWorkOrderBean?.serverServicePeopleSignPath
										?: uiState.value.eleWorkOrderBean?.localServicePeopleSignPath)
							}
						}
					}
				}
			}

			item {
				Spacer(modifier = Modifier.height(20.dp))
				Box(modifier = Modifier
					.fillMaxWidth()
					.padding(horizontal = 16.dp, vertical = 20.dp)) {
					CommonButton(
						text = "上传签字，前往结算单",
					) {
						vm.dispatch(ConfirmEleVm.Action.UpdateState(uiState.value.copy(
							isGoNextPageDialog = true)))
					}
				}
			}
		}
	}
}

@Composable
private fun EleWorkOrderDetailView(eleWorkOrderBean : EleWorkOrderBean?,
	flowType : Int? = null,
	damagePhoto : List<EleCarDamagePhotoBean>? = null) {
	val context = LocalContext.current
	Column(modifier = Modifier
		.fillMaxWidth()
		.padding(10.dp)
		.background(color = Color(0xFFDFE2EA))
		.padding(10.dp)) {
		Spacer(modifier = Modifier.height(10.dp))
		Row(modifier = Modifier.fillMaxWidth(),
			verticalAlignment = Alignment.Bottom,
			horizontalArrangement = Arrangement.SpaceBetween) {
			AsyncImage(model = R.mipmap.ic_company_brand,
				contentDescription = "",
				modifier = Modifier.size(86.dp, 25.dp),
				contentScale = ContentScale.FillWidth)

			Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.Center) {
				Text(text = "车况检查表",
					fontSize = 13.sp,
					color = Color.Black,
					fontWeight = FontWeight.Bold)
			}
			Text(text = "日期:${TimeUtils.millis2String(System.currentTimeMillis(), "yyyy-MM-dd")}",
				color = Color.Black,
				fontWeight = FontWeight.Normal,
				fontSize = 11.sp)
		}
		Spacer(modifier = Modifier.height(5.dp))

		Column(modifier = Modifier
			.fillMaxWidth()
			.border(0.5.dp, color = Color(0xFF989898))
			.padding(10.dp)) {
			Text(text = "一、车辆信息",
				color = Color.Black,
				fontWeight = FontWeight.SemiBold,
				fontSize = 12.sp)

			Spacer(modifier = Modifier.height(5.dp))
			Row(modifier = Modifier.fillMaxWidth(),
				verticalAlignment = Alignment.CenterVertically) {

				Text(text = "车牌号：", fontSize = 12.sp, color = black65)
				Spacer(modifier = Modifier.width(5.dp))
				Text(text = GlobalData.currentOrder?.carNo ?: "",
					textDecoration = TextDecoration.Underline,
					fontSize = 12.sp,
					fontWeight = FontWeight.Medium,
					color = Color.Black)

				Spacer(modifier = Modifier.weight(1f))

				Text(text = "车架号后6位：", fontSize = 12.sp, color = black65)
				Spacer(modifier = Modifier.width(5.dp))
				Text(text = eleWorkOrderBean?.carVin ?: "",
					textDecoration = TextDecoration.Underline,
					fontSize = 12.sp,
					fontWeight = FontWeight.Medium,
					color = Color.Black)
			}

			Spacer(modifier = Modifier.height(5.dp))

			Row(modifier = Modifier.fillMaxWidth(),
				verticalAlignment = Alignment.CenterVertically) {

				Text(text = "救援类型：", fontSize = 12.sp, color = black65)
				Spacer(modifier = Modifier.width(5.dp))
				Text(text = eleWorkOrderBean?.orderType ?: "",
					textDecoration = TextDecoration.Underline,
					fontSize = 12.sp,
					fontWeight = FontWeight.Medium,
					color = Color.Black)

			}

			if (flowType != Const.SMALL_REPAIR) {
				Spacer(modifier = Modifier.height(5.dp))
				Row(modifier = Modifier.fillMaxWidth(),
					verticalAlignment = Alignment.CenterVertically) {
					Text(text = "车辆损伤情况：", fontSize = 12.sp, color = black65)
					Spacer(modifier = Modifier.width(5.dp))
					Text(text = "有损伤".takeIf { true } ?: "无损伤",
						textDecoration = TextDecoration.Underline,
						fontSize = 12.sp,
						fontWeight = FontWeight.Medium,
						color = Color.Black)
				}

				if (! damagePhoto.isNullOrEmpty()) {
					val height = damagePhoto.size.div(3.0)
					LazyVerticalGrid(modifier = Modifier
						.fillMaxWidth()
						.height(80.times(ceil(height)).dp), columns = GridCells.Fixed(3)) {
						items(items = damagePhoto) { item ->
							Box(modifier = Modifier
								.size(110.dp, 76.dp)
								.padding(5.dp),
								contentAlignment = Alignment.BottomCenter) {
								AsyncImage(model = item.serverPath.takeIf { item.path.isNullOrBlank() }
									?: item.path,
									contentDescription = "",
									modifier = Modifier.fillMaxSize(),
									contentScale = ContentScale.FillWidth)
							}
						}
					}
				}
			}
		}

		Spacer(modifier = Modifier.height(10.dp))
		Column(modifier = Modifier
			.fillMaxWidth()
			.border(0.5.dp, color = Color(0xFF989898))
			.padding(10.dp)) {
			Row {
				Text(text = "二、服务须知",
					color = Color.Black,
					fontWeight = FontWeight.SemiBold,
					fontSize = 12.sp)
				Text(text = "（请顾客认证阅读，并在理解且无异议后签字确认）",
					color = Color.Black,
					fontWeight = FontWeight.SemiBold,
					fontSize = 10.sp)
			}

			Box(modifier = Modifier
				.fillMaxWidth()
				.height(200.dp)
				.verticalScroll(rememberScrollState())) {
				Text(text = eleWorkOrderBean?.serviceContent.takeIf { ! eleWorkOrderBean?.serviceContent.isNullOrBlank() }
					?: context.getString(R.string.service_content),
					fontSize = 11.sp,
					color = Color(0xE6252525))
			}

			Spacer(modifier = Modifier.height(10.dp))
			Row(verticalAlignment = Alignment.CenterVertically) {
				AsyncImage(model = R.drawable.sv_star_black,
					contentDescription = "",
					modifier = Modifier.size(15.dp))
				Spacer(modifier = Modifier.width(5.dp))
				Text(text = "客户对上述内容知晓并接受，签字准许实施救援服务。",
					color = Color.Black,
					fontWeight = FontWeight.Bold,
					fontSize = 10.sp)
			}
			Spacer(modifier = Modifier.height(10.dp))
			Text(text = "困境救援案件，为了完成救援而导致的不可避免的车辆损伤，客户自行承担此类风险和损失。",
				color = Color.Black,
				fontWeight = FontWeight.Bold,
				fontSize = 10.sp)

			if (flowType != Const.SMALL_REPAIR) {
				Spacer(modifier = Modifier.height(10.dp))
				Row(verticalAlignment = Alignment.CenterVertically) {
					Text(text = "客户签名:",
						fontSize = 10.sp,
						fontWeight = FontWeight.Bold,
						color = Color.Black)
					Spacer(modifier = Modifier.width(5.dp))

					AsyncImage(model = eleWorkOrderBean?.serverCustomSignPath
						?: eleWorkOrderBean?.localCustomSignPath,
						contentDescription = "",
						modifier = Modifier.size(142.dp, 52.dp),
						contentScale = ContentScale.Fit)
				}
			}
		}
	}
}

@Composable
private fun ConfirmEleCheckBoxItem(modifier : Modifier = Modifier,
	confirmText : String,
	cancelText : String,
	confirmValue : Boolean,
	cancelValue : Boolean,
	confirmCheckedChange : (Boolean) -> Unit,
	cancelCheckedChange : (Boolean) -> Unit) {
	Row(modifier = modifier
		.height(30.dp)
		.background(color = Color.White),
		verticalAlignment = Alignment.CenterVertically) {

		Text(confirmText, color = Color.Black, fontWeight = FontWeight.SemiBold, fontSize = 15.sp)
		Checkbox(checked = confirmValue, onCheckedChange = {
			confirmCheckedChange(it)
		})

		VerticalDivider(modifier = Modifier
			.padding(horizontal = 5.dp, vertical = 5.dp)
			.alpha(0.5f))

		Text(cancelText, color = Color.Black, fontWeight = FontWeight.SemiBold, fontSize = 15.sp)
		Checkbox(checked = cancelValue, onCheckedChange = {
			cancelCheckedChange(it)
		}, colors = CheckboxDefaults.colors().copy(checkedBoxColor = buttonBgColor))
	}
}