using Microsoft.AspNetCore.Mvc;
using kehati.Models.View;

namespace kehati.Controllers
{
    public class KatalogController : Controller
    {
        public IActionResult Index()
        {
            var model = new HomeViewModel
            {
        
                FeaturedLocations = new List<LokasiModel>
                {
                    new()
                    {
                        Slug = "tebet-eco-park",
                        Name = "Tebet Eco Park"
                    },
                    new()
                    {
                        Slug = "hutan-kota-srengseng",
                        Name = "Hutan Kota Srengseng",
                        Image = "loc-srengseng.jpg"
                    },
                    new()
                    {
                        Slug = "mangrove-angke",
                        Name = "Hutan Mangrove Angke"
                    }
                },

                FeaturedSpesies = new List<SpesiesModel>
                {
                    new()
                    {
                        Slug = "pohon-trembesi",
                        Type = "flora",
                        CommonName = "Pohon Trembesi",
                        ScientificName = "Samanea saman",
                        Description =
                        "Pohon peneduh raksasa dengan tajuk lebar menyerupai payung. Sangat efektif menyerap karbon dioksida sehingga banyak ditanam di ruang publik Jakarta.",
                        Habitat = "Tumbuh baik di dataran rendah tropis, tanah subur, sinar matahari penuh.",
                        ConservationStatus = "Aman",
                        Image = "sp-trembesi.jpg",
                        LocationSlugs = new List<string>
                        {
                            "tebet-eco-park",
                            "hutan-kota-gbk",
                            "taman-menteng"
                        }
                    },
                    new()
                    {
                        Slug= "pohon-beringin",
                        Type= "flora",
                        CommonName= "Pohon Beringin",
                        ScientificName= "Ficus benjamina",
                        Description=
                        "Pohon rindang dengan akar udara khas yang menjuntai. Simbol keteduhan dan sering dijumpai di taman kota serta ruang publik Jakarta.",
                        Habitat= "Iklim tropis, tanah lembab, tahan terhadap polusi udara perkotaan.",
                        ConservationStatus= "Aman",
                        Image= "sp-beringin.jpg",
                        LocationSlugs = new List<string> 
                        {"hutan-kota-srengseng", "taman-menteng", "hutan-kota-gbk"}
                    },
                    new()
                    {
                        Slug= "mangrove-rhizophora",
                        Type= "flora",
                        CommonName= "Bakau Merah",
                        ScientificName= "Rhizophora mucronata",
                        Description=
                        "Tumbuhan bakau dengan akar tunjang khas. Berfungsi sebagai benteng alami pesisir Jakarta terhadap abrasi dan intrusi air laut.",
                        Habitat= "Kawasan pesisir berlumpur, muara sungai, air payau.",
                        ConservationStatus= "Dilindungi",
                        Image= "sp-mangrove.jpg",
                        LocationSlugs = new List<string> 
                        {"muara-angke", "mangrove-pik"}
                    },
                    new()
                    {
                        Slug= "bunga-kamboja",
                        Type= "flora",
                        CommonName= "Kamboja Putih",
                        ScientificName= "Plumeria alba",
                        Description=
                        "Pohon hias berbunga harum dengan kelopak putih dan kuning di tengah. Populer di pekarangan dan taman kota.",
                        Habitat= "Daerah tropis kering, tanah berdrainase baik.",
                        ConservationStatus= "Aman",
                        Image= "sp-kamboja.jpg",
                        LocationSlugs = new List<string> 
                        {"tebet-eco-park", "taman-menteng"}
                    },
                    new()
                    {
                        Slug= "anggrek-bulan",
                        Type= "flora",
                        CommonName= "Anggrek Bulan",
                        ScientificName= "Phalaenopsis amabilis",
                        Description=
                        "Bunga nasional Indonesia (Puspa Pesona). Berkelopak lebar putih murni, tumbuh menempel pada batang pohon.",
                        Habitat= "Epifit pada pohon di hutan tropis lembab.",
                        ConservationStatus= "Rentan",
                        Image= "sp-anggrek.jpg",
                        LocationSlugs = new List<string> 
                        {"hutan-kota-srengseng", "tebet-eco-park"}
                    },
                    new()
                    {
                        Slug= "bambu-kuning",
                        Type= "flora",
                        CommonName= "Bambu Kuning",
                        ScientificName= "Bambusa vulgaris",
                        Description=
                        "Rumpun bambu berbatang kuning cerah yang tumbuh cepat. Berperan penting menyerap air tanah dan mencegah erosi.",
                        Habitat= "Tanah lembab di tepi sungai, taman, dan hutan kota.",
                        ConservationStatus= "Aman",
                        Image= "sp-bambu.jpg",
                        LocationSlugs = new List<string> 
                        {"tebet-eco-park", "hutan-kota-srengseng"}
                    },
                    new()
                    {
                        Slug= "burung-kutilang",
                        Type= "fauna",
                        CommonName= "Burung Kutilang",
                        ScientificName= "Pycnonotus aurigaster",
                        Description=
                        "Burung pengicau kecil dengan tunggir kuning cerah. Salah satu burung liar paling umum di taman-taman Jakarta.",
                        Habitat= "Taman kota, pekarangan, hutan sekunder.",
                        ConservationStatus= "Aman",
                        Image= "sp-kutilang.jpg",
                        LocationSlugs = new List<string> 
                        {"tebet-eco-park", "taman-menteng", "hutan-kota-gbk"}
                    },
                    new()
                    {
                        Slug= "burung-madu-sriganti",
                        Type= "fauna",
                        CommonName= "Burung Madu Sriganti",
                        ScientificName= "Cinnyris jugularis",
                        Description=
                        "Burung kecil berwarna cerah, jantan berdada hitam berkilau. Penghisap nektar bunga di taman dan hutan kota.",
                        Habitat= "Taman berbunga, semak berbunga, pinggir hutan.",
                        ConservationStatus= "Dilindungi",
                        Image= "sp-madu-sriganti.jpg",
                        LocationSlugs = new List<string> 
                        {"tebet-eco-park", "hutan-kota-srengseng", "mangrove-pik"}
                    },
                    new()
                    {
                        Slug= "kupu-kupu-raja",
                        Type= "fauna",
                        CommonName= "Kupu-kupu Raja",
                        ScientificName= "Papilio memnon",
                        Description=
                        "Kupu-kupu besar berwarna hitam kebiruan dengan sayap lebar. Penyerbuk penting bagi berbagai tanaman berbunga.",
                        Habitat= "Taman berbunga, hutan sekunder, pinggir sungai.",
                        ConservationStatus= "Aman",
                        Image= "sp-kupu-kupu.jpg",
                        LocationSlugs = new List<string> 
                        {"tebet-eco-park", "hutan-kota-srengseng"}
                    },
                    new()
                    {
                        Slug= "biawak-air",
                        Type= "fauna",
                        CommonName= "Biawak Air",
                        ScientificName= "Varanus salvator",
                        Description=
                        "Reptil besar semi-akuatik dengan lidah bercabang. Predator alami yang membantu mengendalikan populasi tikus di ekosistem kota.",
                        Habitat= "Rawa, sungai, hutan mangrove.",
                        ConservationStatus= "Dilindungi",
                        Image= "sp-biawak.jpg",
                        LocationSlugs = new List<string> 
                        {"muara-angke", "mangrove-pik"}
                    },
                    new()
                    {
                        Slug= "monyet-ekor-panjang",
                        Type= "fauna",
                        CommonName= "Monyet Ekor Panjang",
                        ScientificName= "Macaca fascicularis",
                        Description=
                        "Primata berbulu abu-abu kecoklatan dengan ekor panjang. Hidup berkelompok di kawasan hutan yang tersisa.",
                        Habitat= "Hutan mangrove, hutan sekunder, tepi sungai.",
                        ConservationStatus= "Rentan",
                        Image= "sp-monyet.jpg",
                        LocationSlugs = new List<string> 
                        {"muara-angke", "mangrove-pik"}
                    },
                    new()
                    {
                        Slug= "elang-bondol",
                        Type= "fauna",
                        CommonName= "Elang Bondol",
                        ScientificName= "Haliastur indus",
                        Description=
                        "Elang berkepala putih dengan tubuh coklat kemerahan. Maskot Provinsi DKI Jakarta dan simbol kekayaan hayati pesisir.",
                        Habitat= "Pesisir, mangrove, muara sungai.",
                        ConservationStatus= "Dilindungi",
                        Image= "sp-elang-bondol.jpg",
                        LocationSlugs = new List<string> 
                        {"muara-angke", "mangrove-pik"}
                    }
                }
            };
            return View(model);
        }

        public IActionResult Detail(string slug)
        {
            ViewBag.Slug = slug;

            var sp = new SpesiesModel
            {
                Slug= "elang-bondol",
                Type= "fauna",
                CommonName= "Elang Bondol",
                ScientificName= "Haliastur indus",
                Description=
                "Elang berkepala putih dengan tubuh coklat kemerahan. Maskot Provinsi DKI Jakarta dan simbol kekayaan hayati pesisir.",
                Habitat= "Pesisir, mangrove, muara sungai.",
                ConservationStatus= "Dilindungi",
                Image= "sp-elang-bondol.jpg",
                LocationSlugs = new List<string> 
                {"muara-angke", "mangrove-pik"}
            };

            var model = new HomeViewModel
            {
                Spesies = sp,
                FeaturedLocations = new List<LokasiModel>
                {
                    new()
                    {
                        Slug = "tebet-eco-park",
                        Name = "Tebet Eco Park",
                        Region = "Jakarta Selatan",
                        Area = "15.3 Ha",
                        FloraCount = 45,
                        FaunaCount = 20,
                        Image = "loc-tebet.jpg"
                    },
                    new()
                    {
                        Slug = "hutan-kota-srengseng",
                        Name = "Hutan Kota Srengseng",
                        Image = "loc-srengseng.jpg",
                        Region = "Jakarta Barat",
                        Area = "15.3 Ha",
                        FloraCount = 45,
                        FaunaCount = 20
                    },

                    new()
                    {
                        Slug = "mangrove-angke",
                        Name = "Hutan Mangrove Angke",
                        Region = "Jakarta Barat",
                        Area = "15.3 Ha",
                        FloraCount = 45,
                        FaunaCount = 20,
                        Image = "loc-mangrove-pik.jpg"
                    }
                }
            };

            return View(model);
        }
    }
}