<!--
  ~ Copyright (C) 2022 StApps
  ~ This program is free software: you can redistribute it and/or modify it
  ~ under the terms of the GNU General Public License as published by the Free
  ~ Software Foundation, version 3.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT
  ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  ~ more details.
  ~
  ~ You should have received a copy of the GNU General Public License along with
  ~ this program. If not, see <https://www.gnu.org/licenses/>.
  -->
<mgl-map
  auto-3d
  [styleName]="('(prefers-color-scheme: dark)' | mediaQuery | async) ? 'dark' : 'light'"
  [interactive]="false"
  [attributionControl]="false"
  [center]="$any(place.geo.point.coordinates)"
  [zoom]="[16]"
  [fitBounds]="place.geo | thingBounds"
  [fitBoundsOptions]="{maxZoom: 15, padding: {top: 100, bottom: 50, left: 50, right: 50}}"
>
  @if (place.geo.polygon) {
    <stapps-building-markers [data]="[place] | thingPolygonFeatureCollection"></stapps-building-markers>
  } @else if (place.geo.point) {
    <stapps-poi-markers [data]="[place] | thingPoiFeatureCollection"></stapps-poi-markers>
  }
  <mgl-control position="top-left">
    <ion-button color="primary" shape="round" size="small" [geoNavigation]="place">
      <ion-icon name="directions" slot="start"></ion-icon>
      {{ 'map.directions.TITLE' | translate }}
    </ion-button>
  </mgl-control>
  <mgl-control>
    <ion-button
      color="primary"
      shape="round"
      size="small"
      [routerLink]="['/map']"
      [queryParams]="{bounds: place.geo | thingBounds}"
      [routerAnimation]="maximizeAnimation"
    >
      <ion-icon name="zoom_out_map"></ion-icon>
    </ion-button>
  </mgl-control>
  <mgl-control position="bottom-right">
    <stapps-map-attribution direction="left"></stapps-map-attribution>
  </mgl-control>
</mgl-map>
