import type { DeepReadonly } from "vue"
import type { MaterialRequest } from "../components/MaterialAdjuster.vue"

let _libOutputConfig = {
    textureSrc: "",
    submitCallback: undefined,
    cancelCallback: undefined,
    envTextureSrc: ['./right.webp', './left.webp', './top.webp', './bottom.webp', './front.webp', './back.webp'],
    grayEnvTextureSrc: ['./right-gray.webp', './left-gray.webp', './top-gray.webp', './bottom-gray.webp', './front-gray.webp', './back-gray.webp'],
} as LibOutputConfig

export function ConfigureLibOutput(config: Partial<LibOutputConfig>) {
    Object.assign(_libOutputConfig, {
        ...config
    });
    // _libOutputConfig = config;
}

export type LibOutputConfig = {
    /** 材质贴图链接 */
    textureSrc: string,
    /** 环境贴图链接（立方体贴图，按照顺序输入[右左上下前后]） */
    envTextureSrc: string[],
    /** 灰度环境贴图链接，输入格式与环境贴图一致 */
    grayEnvTextureSrc: string[],
    /** 提交材质时的回调 */
    submitCallback?: (data: MaterialRequest) => void,
    /**
     * 取消材质编辑时的回调
     * @deprecated 不需要使用
     */
    cancelCallback?: () => void
}

export function GetConfig(): DeepReadonly<typeof _libOutputConfig>
{
    return _libOutputConfig;
} 