package $javaPackage;

/**
 * Provides methods to read and build {@link android.content.Intent Intents}.
 */
@javax.annotation.Generated("org.cryptomator.generator.ActivityProcessor")
class $className {

    public static void inject(org.cryptomator.presentation.di.component.ActivityComponent component, org.cryptomator.presentation.ui.activity.BaseActivity activity) {
#foreach( $activity in $activities )
        if (activity instanceof $activity.qualifiedName) {
            component.inject(($activity.qualifiedName)activity);
        } else
#end
        {
            throw new java.lang.IllegalStateException("Failed to inject activity of type " + activity.getClass().getName());
        }
    }

    public static org.cryptomator.presentation.presenter.Presenter initializePresenter(org.cryptomator.presentation.ui.activity.BaseActivity activity) {
#foreach( $activity in $activities )
    if (activity instanceof $activity.qualifiedName) {
        #if ($activity.hasPresenter)
            $activity.qualifiedName castActivity = ($activity.qualifiedName)activity;
            ${activity.presenterQualifiedName} presenter = castActivity.${activity.presenterFieldName};
            presenter.setView(castActivity);
            #if ($activity.presenterHasIntentField)
                presenter.${activity.presenterIntentFieldName} = castActivity.${activity.intentFieldName};
            #end
            return presenter;
        #else
            return null;
        #end
    } else
#end
        {
            throw new java.lang.IllegalStateException("Failed to initialize presenter for " + activity.getClass().getName());
        }
    }

    public static void setIntent(org.cryptomator.presentation.ui.activity.BaseActivity activity) {
#foreach( $activity in $activities )
    #if ($activity.hasIntentField)
        if (activity instanceof $activity.qualifiedName) {
            $activity.qualifiedName castActivity = ($activity.qualifiedName)activity;
            castActivity.${activity.intentFieldName} = org.cryptomator.presentation.intent.Intents.${activity.methodInIntentsName}(castActivity);
        } else
    #end
#end
        {}
    }

    private ${className}() {}

}
