package com.example.fitbot;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

import com.aldebaran.qi.sdk.QiContext;
import com.aldebaran.qi.sdk.QiSDK;
import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
import com.aldebaran.qi.sdk.builder.SayBuilder;
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
import com.aldebaran.qi.sdk.object.conversation.Phrase;
import com.aldebaran.qi.sdk.object.conversation.Say;
import com.aldebaran.qi.sdk.object.locale.Language;
import com.aldebaran.qi.sdk.object.locale.Locale;
import com.aldebaran.qi.sdk.object.locale.Region;
//import com.example.fitbot.ui.SportMenuActivity;

public class MainActivity extends RobotActivity implements RobotLifecycleCallbacks {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Register the RobotLifecycleCallbacks to this Activity.
//        Button button = findViewById(R.id.menu_switch_btn);
//        button.setOnClickListener(v -> {
//            startActivity(new Intent(MainActivity.this, SportMenuActivity.class));
//        });
        QiSDK.register(this, this);

    }

    @Override
    protected void onDestroy() {
        // Unregister the RobotLifecycleCallbacks for this Activity.
        QiSDK.unregister(this, this);
        super.onDestroy();
    }

    @Override
    public void onRobotFocusGained(QiContext qiContext) {
        Locale locale = new Locale(Language.DUTCH, Region.NETHERLANDS);

        // Create a new say action.
        Say say = SayBuilder.with(qiContext) // Create the builder with the context.
                .withText("Hallo hoe gaat het?") // Set the text to say.
                .build(); // Build the say action.

        String locationName = ("de hogeschool van amsterdam");
        String locationDescription = ("0 bitches");

        Phrase namePhrase = new Phrase("Deze locatie is " + locationName);
        Say sayName = SayBuilder.with(qiContext)
                .withPhrase(namePhrase)
                .withLocale(locale)
                .build();

        Phrase descriptionPhrase  = new Phrase(locationDescription);
        Say sayDescription = SayBuilder.with(qiContext)
                .withPhrase(descriptionPhrase)
                .withLocale(locale)
                .build();

        sayName.run();
        sayDescription.run();

        // Create a new BicepVideo with the qiContext
//        BicepVideo BicepVideo = new BicepVideo();
//
//        // Call the videoPlayer method
//        BicepVideo.Video(qiContext);

        // Execute the action.
        say.run();
    }


    @Override
    public void onRobotFocusLost() {
        // Nothing here.
    }

    @Override
    public void onRobotFocusRefused(String reason) {
        // The robot focus is refused.
    }
}