<template>
    <component v-if="!asChild" :is="as" :class="cx('root')" :type="as === 'BUTTON' ? 'button' : undefined" data-action="fullscreen" :data-fullscreen="isFullscreen ? '' : undefined" @click="onClick" v-bind="ptmi('root')">
        <slot :isFullscreen="isFullscreen" />
    </component>
    <slot v-else :class="cx('root')" :onClick="onClick" :isFullscreen="isFullscreen" />
</template>

<script>
import BaseGalleryFullScreen from './BaseGalleryFullScreen.vue';

export default {
    name: 'GalleryFullScreen',
    extends: BaseGalleryFullScreen,
    inheritAttrs: false,
    inject: ['$pcGallery'],
    methods: {
        onClick() {
            this.$pcGallery?.toggleFullScreen();
        }
    },
    computed: {
        isFullscreen() {
            return this.$pcGallery?.isFullscreen ?? false;
        }
    }
};
</script>
