package com.example.countries;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.countries.databinding.ActivityDetailBinding;

public class DetailActivity extends AppCompatActivity {

    private CountryModel country;
    private ActivityDetailBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);

        binding = ActivityDetailBinding.inflate(getLayoutInflater());
        View view = binding.getRoot();
        setContentView(view);

        Intent intent = getIntent();
        country = (CountryModel)intent.getSerializableExtra("COUNTRY");

        assert country != null;
        binding.title.setText(country.nameResId);
        binding.flagImage.setImageResource(country.imageResId);
        binding.descriptionText.setText(country.descriptionResId);
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
    }
}