<template>
  <div class="d-flex flex-column text-wrap">
    <div class="d-flex justify-start justify-md-end">
      <span class="d-none d-md-flex text-right thw-logo-font mr-2">
        {{ above }}
      </span>
      <v-img
        class="d-none d-sm-flex"
        max-width="56"
        max-height="56"
        :src="logo_url"
      />
    </div>
    <v-divider class="d-none d-md-block my-1" />
    <span class="d-none d-md-flex thw-logo-font">
      {{ below }}
    </span>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "@/ovd-vue";

@Component
export default class THWLogo extends Vue {
  private above = "Technisches Hilfswerk";
  private below = "OV Musterstadt";

  private get logo_url(): string {
    return this.$ovdashboard.api_url("file/get/logo");
  }

  public created(): void {
    super.created();
  }

  public beforeDestroy(): void {
    super.beforeDestroy();
  }

  protected update(): void {
    // Update Logo Config
    type LogoConfig = {
      above: string;
      below: string;
    };

    this.$ovdashboard.api_get_object<LogoConfig>("misc/config/logo", (cfg) => {
      this.above = cfg.above;
      this.below = cfg.below;
    });
  }
}
</script>

<style scoped>
.flex-column {
  min-width: 250px;
  max-width: 250px;
}

.v-divider {
  border-width: 1px;
  border-color: white;
}

div.flex-column > div > span:first-child {
  font-size: 28px;
  line-height: 28px;
  align-items: center;
}

div.flex-column > span:last-child {
  font-size: 15px;
  line-height: 15px;
}
</style>
