import { create } from 'zustand';

export type PrintOrientation = 'horizontal' | 'vertical'

export type PrintFormat = 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5'
export const printResolutions = ['72', '150', '200', '300']

export interface PrintState {
    printFormat: PrintFormat;
    printOrientation: PrintOrientation;
    printResolution: number;
}

export const usePrintStore = create<PrintState>(() => ({
    printFormat: 'a4',
    printOrientation: 'horizontal',
    printResolution: 72
}))

export const getPrintOrientation = () => usePrintStore.getState().printOrientation
export const setPrintFormat = (format: PrintFormat) => usePrintStore.setState(() => ({ printFormat: format }))
export const setPrintOrientation = (orientation: PrintOrientation) => usePrintStore.setState(() => ({ printOrientation: orientation }))
export const setPrintResolution = (resolution: number) => usePrintStore.setState(() => ({ printResolution: resolution }))