"""Transform controls panel component."""

from __future__ import annotations

import dash_bootstrap_components as dbc
from dash import html


def build_transform_panel() -> dbc.Card:
    """Build the transform controls card."""
    return dbc.Card(
        [
            dbc.CardHeader("Transforms", className="fw-bold py-2"),
            dbc.CardBody(
                [
                    # CFC Filter
                    dbc.Label("CFC Filter", size="sm", className="mb-1"),
                    dbc.Select(
                        id="cfc-select",
                        options=[
                            {"label": "None (raw)", "value": "none"},
                            {"label": "CFC 60 (100 Hz)", "value": "60"},
                            {"label": "CFC 180 (300 Hz)", "value": "180"},
                            {"label": "CFC 600 (1000 Hz)", "value": "600"},
                            {"label": "CFC 1000 (1650 Hz)", "value": "1000"},
                        ],
                        value="none",
                        size="sm",
                        className="mb-2",
                    ),
                    # Resultant toggle
                    dbc.Checkbox(
                        id="show-resultant",
                        label="Compute resultant",
                        value=False,
                        className="mb-1",
                    ),
                    # Y-align toggle
                    dbc.Checkbox(
                        id="y-align-check",
                        label="Y-axis zero correction",
                        value=False,
                        className="mb-2",
                    ),
                    html.Hr(style={"margin": "8px 0"}),
                    # X-align controls
                    dbc.Label("X-Axis Alignment", size="sm", className="mb-1"),
                    dbc.Select(
                        id="x-align-method",
                        options=[
                            {"label": "None", "value": "none"},
                            {"label": "Manual offset", "value": "manual"},
                            {"label": "Threshold crossing", "value": "threshold"},
                        ],
                        value="none",
                        size="sm",
                        className="mb-1",
                    ),
                    dbc.Input(
                        id="x-align-value",
                        type="number",
                        placeholder="Time offset (s) or threshold",
                        size="sm",
                        step=0.001,
                        className="mb-1",
                        style={"display": "none"},
                    ),
                ],
                className="py-2",
            ),
        ]
    )
