import plotly.graph_objects as go


def load_data():
    return [
        (12, -1800),
        (15, -900),
        (18, 0),
        (21, 900),
        (24, 1800),
    ]


def value_table(data):
    return {
        "columns": ["Electricity price (cents per kWh)", "Annual net savings (dollars)"],
        "rows": [list(row) for row in data],
    }


def make_before(data) -> go.Figure:
    _, savings = data[-1]
    fig = go.Figure(go.Bar(x=["Heat pump"], y=[savings], marker_color="#356890"))
    fig.update_layout(
        template="simple_white",
        font={"family": "Inter, system-ui, -apple-system, sans-serif", "color": "#1f2937"},
        title="Estimated heat pump savings",
        yaxis={"title": "Annual net savings (dollars)", "range": [0, 2100]},
        margin={"l": 88, "r": 24, "t": 56, "b": 52},
    )
    return fig


if __name__ == "__main__":
    print(make_before(load_data()).to_json())
