package com.gh.gamecenter.gamedetail.accelerator.chain

import android.content.Context

class AcceleratorClient(
    private vararg val interceptors: AcceleratorValidator.Interceptor,
) {

    fun execute(
        context: Context,
        request: AcceleratorValidator.Request,
        listener: AcceleratorValidator.ValidateListener
    ) {
        val chain = RealAcceleratorInterceptorChain(interceptors.toList(), 0, request)
        chain.proceed(context, request, listener)
    }

    companion object {

        fun newInstance() = AcceleratorClient(
            AcceleratorCheckInstallInterceptor(),
            AcceleratorLoginInterceptor(),
            AcceleratorPackageCheckInterceptor(),
            AcceleratorRealNameInterceptor(),
            AcceleratorPermissionGuideInterceptor(),
            AcceleratorStateInterceptor()
        )
    }
}