# RestrictedArea.java

    package io.github.js0ny.ilp_coursework.data.external;

    import io.github.js0ny.ilp_coursework.data.common.AltitudeRange;
    import io.github.js0ny.ilp_coursework.data.common.LngLat;
    import io.github.js0ny.ilp_coursework.data.common.LngLatAlt;
    import io.github.js0ny.ilp_coursework.data.common.Region;

    import java.util.ArrayList;
    import java.util.List;

    public record RestrictedArea(String name, int id, AltitudeRange limits, LngLatAlt[] vertices) {
        public Region toRegion() {
            List<LngLat> vertices2D = new ArrayList<>();
            for (var vertex : vertices) {
                vertices2D.add(new LngLat(vertex.lng(), vertex.lat()));
            }
            return new Region(name, vertices2D);
        }
    }