package com.nivesh.production.partnerOnBoarding.ui.activities

import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import com.nivesh.production.partnerOnBoarding.R
import com.nivesh.production.partnerOnBoarding.api.ApiClient
import com.nivesh.production.partnerOnBoarding.databinding.ActivitySignupBinding
import com.nivesh.production.partnerOnBoarding.providerfactory.OnBoardingModelProviderFactory
import com.nivesh.production.partnerOnBoarding.repositories.MainRepository
import com.nivesh.production.partnerOnBoarding.ui.fragments.SignUpFragment
import com.nivesh.production.partnerOnBoarding.viewModels.OnBoardingViewModel

class SignUpActivity : BaseActivity() {
    lateinit var binding: ActivitySignupBinding
    lateinit var viewModelOne: OnBoardingViewModel
    var type: Int? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        init()
    }

    private fun init() {
        viewModelOne = ViewModelProvider(
            this@SignUpActivity,
            OnBoardingModelProviderFactory(MainRepository(ApiClient.getApiClientOne))
        )[OnBoardingViewModel::class.java]

        type = intent.getIntExtra("type", 0)

        binding = ActivitySignupBinding.inflate(layoutInflater)
        binding.apply {
            setContentView(this.root)
        }
        val bundle = Bundle()
        bundle.putInt("type", type!!)
        bundle.putString("arnType",intent.getStringExtra("arnType"))
        val fragment = SignUpFragment()
        fragment.arguments = bundle

        supportFragmentManager.beginTransaction().add(R.id.signUpContainer, fragment).commit()
    }

}