<template>
  <div class="container py-4">
    <page-editor-structure :page="page" :with-actions="!isNew" />
    <schema-field v-model="version.name" :schema="versionSchemaProperties.name" />
  </div>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';
import { Schema, Version, VersionedPage } from '../types/api';
import { namespace } from 'vuex-class';

import PageEditorStructure from './page-editor-structure.vue';

const PageStore = namespace('pages');

@Component({
  components: {
    PageEditorStructure
  }
})
export default class PageEditorSettings extends Vue {
  @Prop(Boolean) readonly isNew!: boolean;
  @Prop(Object) readonly page!: VersionedPage;
  @Prop(Object) readonly version!: Version;

  @PageStore.State('schema') readonly schema!: Schema;

  get versionSchemaProperties() {
    return this.schema.properties;
  }
}
</script>

<style scoped>

</style>
