package com.za.ui.servicing.in_servicing_setting

import android.content.Context
import android.content.Intent
import android.os.Build
import androidx.compose.runtime.Composable
import com.za.base.BaseActivity
import com.za.base.Const
import com.za.bean.db.order.OrderInfo

class OrderRequirementsActivity : BaseActivity() {
    @Composable
    override fun ContentView() {
        val orderInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
            intent.getParcelableExtra("orderInfo", OrderInfo::class.java)
        } else {
            intent.getParcelableExtra("orderInfo")
        }

        val type = intent.getIntExtra("type", 0)
        when (type) {
            Const.InServiceSettingType.ON_SITE_PHOTO -> OrderOnSitePhotoScreen(orderInfo)
            Const.InServiceSettingType.ORDER_REQUIREMENTS -> OrderRequirementsScreen(orderInfo = orderInfo)
            Const.InServiceSettingType.ORDER_DETAIL -> OrderDetailScreen(orderInfo = orderInfo)
            Const.InServiceSettingType.ORDER_GIVE_UP -> OrderRequirementsScreen(orderInfo = orderInfo)
        }
    }

    companion object {
        // type 0 现场照片
        fun goOrderRequirementsActivity(context: Context, orderInfo: OrderInfo?, type: Int) {
            val intent = Intent(context, OrderRequirementsActivity::class.java)
            intent.putExtra("type", type)
            intent.putExtra("orderInfo", orderInfo)
            context.startActivity(intent)
        }
    }
}
