package com.fastest.pass.mastersignup.presentation.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import com.fastest.pass.BaseFragment
import com.fastest.pass.mastersignup.presentation.ui.components.ClickType
import com.fastest.pass.mastersignup.presentation.ui.components.MasterSignUpScreen
import com.fastest.pass.mastersignup.presentation.viewmodels.MasterSignUpViewModel
import com.fastest.pass.mastersignup.utils.MasterSignUpNavigation
import com.fastest.pass.mastersignup.utils.MasterSignUpRoute
import com.fastest.pass.ui.theme.FastestPassTheme
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class MasterSignUpFragment : BaseFragment() {

    val viewmodel: MasterSignUpViewModel by viewModels()

    @Inject
    lateinit var navigation: MasterSignUpNavigation

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        navigation.navigate(this)
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        return ComposeView(requireActivity()).apply {
            setContent {
                FastestPassTheme {
                    MasterSignUpScreen { clickType ->
                        when (clickType) {
                            ClickType.GO_BACK -> {
                                viewmodel.navigateTo(MasterSignUpRoute.GoBackToSignUp)
                            }
                            ClickType.GO_TO_HOME -> {

                            }
                        }
                    }
                }
            }
        }
    }

}