import plotly.graph_objects as go


def load_data():
    return [
        ("1973-01-01", 2.0),
        ("1974-01-01", 9.5),
        ("1975-01-01", 10.0),
        ("1976-01-01", 11.2),
        ("1977-01-01", 12.0),
        ("1978-01-01", 12.7),
        ("1979-01-01", 13.34),
        ("1979-04-01", 13.84),
        ("1979-07-01", 14.16),
        ("1979-10-01", 14.54),
    ]


def value_table(data):
    return {"columns": ["Date", "Oil price (USD per barrel)"], "rows": [list(row) for row in data]}


def make_after(data) -> go.Figure:
    dates, prices = zip(*data, strict=True)
    fig = go.Figure(go.Scatter(x=dates, y=prices, mode="lines+markers"))
    fig.update_layout(
        template="simple_white",
        xaxis_type="date",
        xaxis_title="Date",
        yaxis_title="Oil price (nominal USD per barrel)",
    )
    fig.update_layout(
        font={"family": "Inter, system-ui, -apple-system, sans-serif", "color": "#1f2937"},
        colorway=["#3b82c4", "#d97706", "#14967f", "#8b5cf6", "#dc4c3e", "#78716c"],
    )
    return fig


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