"""Report generation panel component."""

from __future__ import annotations

import dash_bootstrap_components as dbc
from dash import dcc, html


def build_report_panel() -> dbc.Card:
    """Build the report generation card."""
    return dbc.Card(
        [
            dbc.CardHeader("Export", className="fw-bold py-2"),
            dbc.CardBody(
                [
                    # Plot export
                    dbc.Label("Plot Export", size="sm", className="mb-1"),
                    dbc.ButtonGroup(
                        [
                            dbc.Button(
                                "PNG",
                                id="export-png-btn",
                                color="outline-secondary",
                                size="sm",
                                style={"fontSize": "11px"},
                            ),
                            dbc.Button(
                                "SVG",
                                id="export-svg-btn",
                                color="outline-secondary",
                                size="sm",
                                style={"fontSize": "11px"},
                            ),
                            dbc.Button(
                                "PDF",
                                id="export-pdf-btn",
                                color="outline-secondary",
                                size="sm",
                                style={"fontSize": "11px"},
                            ),
                        ],
                        className="mb-2 w-100",
                    ),
                    html.Hr(style={"margin": "6px 0"}),
                    # Data export
                    dbc.Label("Data Export", size="sm", className="mb-1"),
                    dbc.Button(
                        "Export CSV",
                        id="export-csv-btn",
                        color="outline-secondary",
                        size="sm",
                        className="w-100 mb-2",
                        style={"fontSize": "11px"},
                    ),
                    html.Hr(style={"margin": "6px 0"}),
                    # Report generation
                    dbc.Label("Protocol Report", size="sm", className="mb-1"),
                    dbc.Button(
                        "Generate Report",
                        id="generate-report-btn",
                        color="success",
                        size="sm",
                        className="w-100",
                        style={"fontSize": "11px"},
                    ),
                    html.Div(id="report-status", className="mt-2"),
                    # Download component (hidden, triggered by callbacks)
                    dcc.Download(id="download-export"),
                ],
                className="py-2",
            ),
        ]
    )
