package com.ys.bdtp.adm.mvvm.ui.screen.task

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.ys.bdtp.adm.R
import com.ys.bdtp.adm.mvvm.ui.examine.Space3DActivity.Companion.startSpace3DActivity
import com.ys.bdtp.adm.mvvm.ui.screen.main.LocalNavHostController
import com.ys.bdtp.adm.mvvm.ui.screen.main.Route

@Composable
fun TaskSide(nav: NavHostController, projectId: String) {
    val context = LocalContext.current
    Column(
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        TaskType(R.drawable.project_task_cad, "CAD核查") {
            nav.navigate("${Route.Cad}/$projectId")
        }
        Spacer(modifier = Modifier.height(20.dp))
        TaskType(R.drawable.project_task_space, "空间模型核查") {
            startSpace3DActivity(context, projectId)
        }
        Spacer(modifier = Modifier.height(20.dp))
        TaskType(R.drawable.project_task_electric, "机电核查") {}
        Spacer(modifier = Modifier.height(20.dp))
        TaskType(R.drawable.project_task_relation, "交付关系") {}
        Spacer(modifier = Modifier.height(20.dp))
        TaskType(R.drawable.project_task_offline, "离线数据") {
            nav.navigate("${Route.Offline}/$projectId")
        }
    }
}

@Preview
@Composable
fun PreviewTaskSide() {
    val nav = LocalNavHostController.current!!
    TaskSide(nav, "")
}