"""Three ways the auto-router can connect two ports.

`Route(a, b)` picks geometry based on port directions:
    - cardinal + perpendicular → Manhattan (90° elbows)
    - cardinal + parallel       → direct (Dubins arcs)
    - any non-cardinal          → direct
You can force a style with `style="manhattan" | "direct" | "sbend"`.
"""
import lumicron as lm
import lumicron.pdks.elyon_demo.all as pdk


@lm.pcell
def RouteStyles():
    c = lm.CELL("RouteStyles")

    # Three port pairs stacked vertically. Same span, different styles.
    rows = [
        ("manhattan", 0, 200),
        ("direct", 0, 600),
        ("sbend", 0, 1000),
    ]
    for style, y, _ in rows:
        c.add(lm.PORT(
            f"{style}_in", position=(0, y), direction=0,
            width=0.5, layer=pdk.LAYER.SILC,
        ))
        c.add(lm.PORT(
            f"{style}_out", position=(400, y + 80), direction=180,
            width=0.5, layer=pdk.LAYER.SILC,
        ))
        c.Route(
            c.ports[f"{style}_in"],
            radius=20,
            style=style,
        ).to(c.ports[f"{style}_out"])
    return c


if __name__ == "__main__":
    RouteStyles().to_gds("route_styles.gds")
