// Copyright (c) 2026 Jose Cely <me@jacs.guru>
// Use of this source code is governed by MIT-style
// license that can be found in the LICENSE file.

package controllers

import (
	"html/template"

	"git.smarteching.com/goffee/core"
)


// TablerDemo1 renders a Tabler-themed demo page
func TablerDemo1(c *core.Context) *core.Response {

	// first, include compoment
	type templateData struct {
		Content template.HTML
	}	
	// Build the template data
	data := templateData{
		// The main page content (rendered HTML)
		Content: template.HTML("<h2>Hola mundo</h2>"),
	}

	return c.Response.Template("tabler_demo.html", data)
}

// TablerSingle renders a page using the single layout (centered page with logo)
func TablerSingle(c *core.Context) *core.Response {
	data := TablerPageData{
		PageTitle:       "Tabler Single",
		PageDescription: "A single centered page",
		Content:         template.HTML("<div class=\"card card-md\"><div class=\"card-body\"><h2 class=\"card-title text-center mb-4\">Login</h2><p class=\"text-secondary mb-4\">Enter your credentials to access your account.</p></div></div>"),
	}
	return c.Response.Template("tabler_single.html", data)
}

// TablerDefault renders a page using the default layout (with navbar, page header, footer)
func TablerDefault(c *core.Context) *core.Response {
	data := TablerPageData{
		PageTitle:       "Tabler Default",
		PageDescription: "A default page layout",
		Sidebar:         false,
		ShowTopbar:      true,
		PageHeader:      "Default Page",
		PagePretitle:    "Overview",
		UserName:        "Jane Doe",
		UserRole:        "Administrator",
		Content:         template.HTML("<div class=\"card\"><div class=\"card-body\"><h3 class=\"card-title\">Content Area</h3><p>This is the main content area of the default page layout.</p></div></div>"),
	}
	return c.Response.Template("tabler_default.html", data)
}

// TablerNavbar renders a page using the default layout (with navbar, navbarmenu, page header, footer)
func TablerNavbar(c *core.Context) *core.Response {
	data := TablerPageData{
		PageTitle:       "Navbar Menu Demo",
		PageDescription: "Sample page with navbar menu",
		ShowTopbar:      true,
		Sidebar:         false,
		PageHeader:      "Navbar Menu Demo",
		PagePretitle:    "Components",
		UserName:        "Jane Doe",
		UserRole:        "Administrator",
		NavbarMenu:      SampleNavbarMenu(),
		Content:         template.HTML("<div class=\"card\"><div class=\"card-body\"><h3 class=\"card-title\">Navbar Menu Example</h3><p>This page demonstrates the navbar menu component migrated from the Liquid template. The menu items (Dashboards, Layout, Help) are rendered from sample data.</p></div></div>"),
	}
	return c.Response.Template("tabler_default.html", data)
}

// TablerHome renders the homepage/dashboard layout
func TablerHome(c *core.Context) *core.Response {
	data := TablerPageData{
		PageTitle:       "Dashboard",
		PageDescription: "Dashboard home page",
		PageHeader:      "Dashboard",
		PagePretitle:    "Overview",
		UserName:        "Jane Doe",
		UserRole:        "Administrator",
		ShowTopbar:      true,
		Sidebar:         false,
	}
	return c.Response.Template("tabler_homepage.html", data)
}