"""A cladded route profile — core + symmetric oxide cladding.

`p.layer()` can be called any number of times. Each call adds one
parallel stroke to the cross-section. Use it for claddings, exclusion
zones, slot-mode rails, or any sibling band that should run alongside
the core.
"""
import lumicron as lm
import lumicron_pdk as lpdk

LAYER = lpdk.LayerTable(
    SILC = lpdk.Layer(9, 0, color="#008000", min_width=0.2, min_radius=5.0),
    OXID = lpdk.Layer(1, 0, color="#87ceeb"),
)


@lpdk.route_profile(port_width=0.5, radius=10.0, radius_min=5.0)
def silc_cladded(p):
    """Silicon core with a 4 µm oxide cladding on either side."""
    p.layer(LAYER.SILC, width=p.port_width)
    p.layer(LAYER.OXID, width=p.port_width + 4.0)


@lm.pcell
def CladdedProfileDemo():
    c = lm.CELL("CladdedProfileDemo")
    c.add(lm.PORT(
        "in", position=(0, 0), direction=0,
        route_profile=silc_cladded,
    ))
    c.add(lm.PORT(
        "out", position=(400, 200), direction=180,
        route_profile=silc_cladded,
    ))
    c.Route(c.ports["in"], c.ports["out"])
    return c


if __name__ == "__main__":
    CladdedProfileDemo().to_gds("cladded_profile_demo.gds")
