<template>
  <q-page>
    <div class="q-pa-md">
      <div class="q-gutter-sm row items-start">
        <q-breadcrumbs>
          <q-breadcrumbs-el icon="home" label="ホーム" />
        </q-breadcrumbs>
      </div>
      <div class="q-gutter-sm row items-start">
        <doc-uploader @uploaded="onAppUploaded"></doc-uploader>
      </div>
      <app-info v-if="props?.app" :app="props?.app"></app-info>
    </div>
  </q-page>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import DocUploader from 'components/DocUpload.vue';
import AppInfo from 'components/AppInfo.vue';
import { AppSeed } from 'src/components/models';

interface AppInfo {
  app: string;
  revision: string;
}

const appseed = withDefaults(defineProps<AppSeed>(), {
  app: '',
});

// const appseed = defineProps<AppSeed>();

const props = ref(appseed);

function onAppUploaded(responseText: string) {
  let json: AppInfo = JSON.parse(responseText);
  props.value = json;
}
</script>
