package tw.com.altob.goodpk.Util;

import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;

import tw.com.altob.goodpk.Activity.CarLockActivity;
import tw.com.altob.goodpk.Activity.CarSecurityActivity;
import tw.com.altob.goodpk.Activity.HomeActivity;
import tw.com.altob.goodpk.Activity.InquireCarActivity;
import tw.com.altob.goodpk.Activity.HelpActivity;
import tw.com.altob.goodpk.Activity.PWActivity;
import tw.com.altob.goodpk.Activity.PaymentActivity;

public class CommonIntent {

    @NonNull
    public static Intent createHomeActivity(@NonNull Context context) {
        return createHomeActivity(context, -1);
    }

    @NonNull
    public static Intent createHomeActivity(@NonNull Context context, int index) {
        return createHomeActivity(context, index, false);
    }

    @NonNull
    public static Intent createHomeActivity(@NonNull Context context, boolean option) {
        return createHomeActivity(context, -1, option);
    }

    @NonNull
    private static Intent createHomeActivity(@NonNull Context context, int index, boolean option) {
        Intent intent = new Intent(context, HomeActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        if (index >= 0) {
            intent.putExtra(ExtraKey.ID, index);
        }

        if (option) {
            intent.putExtra(ExtraKey.OPTION, true);
        }

        return intent;
    }


    @NonNull
    public static Intent createHelpActivity(@NonNull Context context) {

        Intent intent = new Intent(context, HelpActivity.class);

        return intent;
    }


    @NonNull
    public static Intent createInquireCarActivity(@NonNull Context context) {

        Intent intent = new Intent(context, InquireCarActivity.class);

        return intent;
    }


    @NonNull
    public static Intent createCarSecurityActivity(@NonNull Context context, String station) {

        Intent intent = new Intent(context, CarSecurityActivity.class);
        intent.putExtra(ExtraKey.DATA, station);
        return intent;
    }

    @NonNull
    public static Intent createPaymentActivity(@NonNull Context context) {

        Intent intent = new Intent(context, PaymentActivity.class);

        return intent;
    }

    @NonNull
    public static Intent createChangePWActivity(@NonNull Context context) {

        Intent intent = new Intent(context, PWActivity.class);

        return intent;
    }

    @NonNull
    public static Intent createCarLockActivity(@NonNull Context context, String acct, String pwd, String msg, String station) {

        Intent intent = new Intent(context, CarLockActivity.class);
        intent.putExtra(ExtraKey.ID, acct);
        intent.putExtra(ExtraKey.DATA, pwd);
        intent.putExtra(ExtraKey.OPTION, msg);
        intent.putExtra(ExtraKey.LOCATION, station);
        return intent;
    }
}
