import { Component, Prop, ModelSync, Vue, Watch, Model } from 'vue-property-decorator';
import dataBlock from '@components/cards/statements/components/dataBlock.vue';

@Component({
  components: {
    dataBlock,
  },
})
export default class Dialog extends Vue {
  @Model('update', { default: () => false })
  value: boolean;

  @Prop({ default: false })
  disable: boolean;

  @Watch('value')
  onChange(opened: boolean): void {
    this.opened = opened;
  }

  opened = false;

  open(): void {
    if (this.disable) return;
    this.opened = true;
    this.$emit('open');
  }

  close(): void {
    this.opened = false;
    this.$emit('close');
  }
}
