package com.ama.core.architecture.appBase.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import com.ama.core.architecture.base.views.adapter.BaseFragmentStateAdapter
import com.ama.core.model.BaseFragmentStateDiffItem


abstract class AppFragmentStateAdapter<T : BaseFragmentStateDiffItem>(
    fragmentManager: FragmentManager,
    lifecycle: Lifecycle,
    isFragmentLazyInit: Boolean,
) : BaseFragmentStateAdapter<T>(fragmentManager, lifecycle, isFragmentLazyInit) {
    constructor(
        activity: FragmentActivity,
        isFragmentLazyInit: Boolean,
    ) : this(activity.supportFragmentManager, activity.lifecycle, isFragmentLazyInit)

    constructor(
        fragment: Fragment, isFragmentLazyInit: Boolean,
    ) : this(fragment.childFragmentManager, fragment.lifecycle, isFragmentLazyInit)
}