<script setup lang="ts">
import FullscreenButton from "./FullscreenButton.vue";
import PageIndicator from "./PageIndicator.vue";
import ZoomSlider from "./ZoomSlider.vue";

defineProps<{
    currentPage: number;
    maxPage: number;
    currentZoom: number;
    clientType: "pc" | "ipad" | "mobile";
    themeColor?: string;
}>();

const emit = defineEmits<{
    pageChange: [page: number];
    zoomChange: [zoom: number];
    fullscreen: [];
}>();

const handlePageChange = (page: number) => {
    emit('pageChange', page);
};

const handleZoomChange = (zoom: number) => {
    emit('zoomChange', zoom);
};

const handleFullscreen = () => {
    emit('fullscreen');
};
</script>

<template>
    <div class="document-controls">
        <PageIndicator 
            :value="currentPage" 
            :max-page="maxPage" 
            :client-type="clientType" 
            @change="handlePageChange" 
        />
        <div class="document-controls__right">
            <ZoomSlider 
                :current-zoom="currentZoom" 
                :client-type="clientType" 
                :theme-color="themeColor" 
                @change="handleZoomChange" 
            />
            <FullscreenButton 
                v-if="clientType === 'pc'" 
                @click="handleFullscreen" 
            />
        </div>
    </div>
</template>

<style>
.document-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-controls__right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
}
</style>
