import { MutationPayload, Store } from 'vuex';

/*****************************************************************
 * VUEX-STATE-STORAGE-SYNC - Minimal Persist/Synchronize State Plugin for Vuex
 * (c) 2024-present AGUMON (https://github.com/ljlm0402/vuex-state-storage-sync)
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the project root for more information.
 *
 * Made with ❤️ by AGUMON 🦖
 *****************************************************************/

/**
 * Storage 인터페이스 정의
 * removeItem은 optional로 두어 다양한 storage 엔진을 지원
 */
interface Storage {
    getItem: (key: string) => string | null;
    setItem: (key: string, value: string) => void;
    removeItem?: (key: string) => void;
}
type ArrayMergeFn = (storeArr: any[], savedArr: any[]) => any[];
interface Options<State> {
    key?: string;
    storage?: Storage;
    paths?: string[];
    overwrite?: boolean;
    fetchBeforeUse?: boolean;
    getState?: (key: string, storage: Storage) => any;
    setState?: (key: string, state: any, storage: Storage) => void;
    removeState?: (key: string, storage: Storage) => void;
    reducer?: (state: State, paths?: string[]) => object;
    filter?: (mutation: MutationPayload) => boolean;
    merge?: (obj1: object | any[], obj2: object | any[], options: object) => object | any[];
    arrayMerge?: ArrayMergeFn;
    arrayMerger?: ArrayMergeFn;
    rehydrated?: (store: Store<State>) => void;
    subscriber?: (store: Store<State>) => (handler: (mutation: any, state: State) => void) => void;
    assertStorage?: (storage: Storage) => void | Error;
}
/**
 * vuex-state-storage-sync 플러그인 메인 함수
 * @param options 사용자 지정 옵션
 */
declare function export_default<State extends object = any>(options?: Options<State>): (store: Store<State>) => void;

export { export_default as default };
