package com.example.cuida.ui.sns24;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.example.cuida.databinding.FragmentSns24Binding;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;

public class Sns24Fragment extends Fragment {

    private FragmentSns24Binding binding;
    private FusedLocationProviderClient fusedLocationClient;

    public View onCreateView(@NonNull LayoutInflater inflater,
            ViewGroup container, Bundle savedInstanceState) {
        binding = FragmentSns24Binding.inflate(inflater, container, false);

        fusedLocationClient = LocationServices.getFusedLocationProviderClient(requireActivity());

        // Initialize Gemini
        // generativeModel = new GenerativeModel("gemini-pro", GEMINI_API_KEY); //
        // Removed

        binding.buttonCallSns.setOnClickListener(v -> {
            try {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse("tel:808242424"));
                startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(getContext(), "Não foi possível realizar a chamada.", Toast.LENGTH_SHORT).show();
            }
        });

        // binding.buttonTriage.setOnClickListener(v -> performTriage()); // Removed

        return binding.getRoot();
    }

    // AI Triage methods removed

    // Nearest Hospital feature removed with AI Triage

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
}
