'use strict';

var UnitySceneImporter = require('./UnitySceneImporter.js');
var GodotSceneImporter = require('./GodotSceneImporter.js');
var TiledMapImporter = require('./TiledMapImporter.js');
var LDtkImporter = require('./LDtkImporter.js');
var AsepriteImporter = require('./AsepriteImporter.js');
var OgmoImporter = require('./OgmoImporter.js');
var RPGMakerImporter = require('./RPGMakerImporter.js');
var GameMakerImporter = require('./GameMakerImporter.js');
var SpineImporter = require('./SpineImporter.js');
var DragonBonesImporter = require('./DragonBonesImporter.js');
var Live2DImporter = require('./Live2DImporter.js');
var SpriterImporter = require('./SpriterImporter.js');
var NdgFormat = require('./NdgFormat.js');

/**
 * @file index.ts
 * @description Scene Format Import Module Exports
 * PRO-1.3: Scene Format Interoperability
 */
// ============================================================
// Base Importer
// ============================================================
/**
 * Create an importer for the specified source type
 */
function createImporter(sourceType) {
    switch (sourceType) {
        case 'unity':
            return new UnitySceneImporter.UnitySceneImporter();
        case 'godot':
            return new GodotSceneImporter.GodotSceneImporter();
        case 'tiled':
            return new TiledMapImporter.TiledMapImporter();
        case 'ldtk':
            return new LDtkImporter.LDtkImporter();
        case 'aseprite':
            return new AsepriteImporter.AsepriteImporter();
        case 'ogmo':
            return new OgmoImporter.OgmoImporter();
        case 'rpgmaker':
            return new RPGMakerImporter.RPGMakerImporter();
        case 'gamemaker':
            return new GameMakerImporter.GameMakerImporter();
        case 'spine':
            return new SpineImporter.SpineImporter();
        case 'dragonbones':
            return new DragonBonesImporter.DragonBonesImporter();
        case 'live2d':
            return new Live2DImporter.Live2DImporter();
        case 'spriter':
            return new SpriterImporter.SpriterImporter();
        default:
            throw new Error(`Unsupported import source type: ${sourceType}`);
    }
}
/**
 * Create importer for NDG native format
 */
function createNativeImporter() {
    return new NdgFormat.NdgImporter();
}
/**
 * Get importer for file based on extension
 */
function getImporterForFile(filePath) {
    const ext = filePath.substring(filePath.lastIndexOf('.')).toLowerCase();
    const name = filePath.toLowerCase();
    // NDG native format
    if (['.ndg', '.ndgp', '.ndga'].includes(ext)) {
        return new NdgFormat.NdgImporter();
    }
    // Unity
    if (['.unity', '.prefab'].includes(ext)) {
        return new UnitySceneImporter.UnitySceneImporter();
    }
    // Godot
    if (['.tscn', '.tres'].includes(ext)) {
        return new GodotSceneImporter.GodotSceneImporter();
    }
    // Tiled
    if (['.tmx', '.tmj', '.tsx', '.tsj'].includes(ext)) {
        return new TiledMapImporter.TiledMapImporter();
    }
    // LDtk
    if (['.ldtk', '.ldtkl'].includes(ext)) {
        return new LDtkImporter.LDtkImporter();
    }
    // Aseprite
    if (['.aseprite', '.ase'].includes(ext)) {
        return new AsepriteImporter.AsepriteImporter();
    }
    // OGMO
    if (ext === '.ogmo' || name.includes('ogmo')) {
        return new OgmoImporter.OgmoImporter();
    }
    // RPG Maker
    if (name.includes('map') && ext === '.json') {
        return new RPGMakerImporter.RPGMakerImporter();
    }
    // GameMaker
    if (['.yy', '.yyp'].includes(ext)) {
        return new GameMakerImporter.GameMakerImporter();
    }
    // Spine
    if (ext === '.skel' || ext === '.atlas' || name.endsWith('.spine.json')) {
        return new SpineImporter.SpineImporter();
    }
    // DragonBones
    if (name.endsWith('_ske.json') || name.endsWith('_tex.json')) {
        return new DragonBonesImporter.DragonBonesImporter();
    }
    // Live2D
    if (name.endsWith('.model3.json') ||
        ext === '.moc3' ||
        name.endsWith('.physics3.json') ||
        name.endsWith('.pose3.json') ||
        name.endsWith('.exp3.json') ||
        name.endsWith('.motion3.json')) {
        return new Live2DImporter.Live2DImporter();
    }
    // Spriter
    if (['.scml', '.scon'].includes(ext)) {
        return new SpriterImporter.SpriterImporter();
    }
    return null;
}
/**
 * Check if a file can be imported
 */
function canImport(filePath) {
    return getImporterForFile(filePath) !== null;
}
/**
 * Get all supported file extensions
 */
function getSupportedExtensions() {
    return [
        // Native
        '.ndg',
        '.ndgp',
        '.ndga',
        // Unity
        '.unity',
        '.prefab',
        // Godot
        '.tscn',
        '.tres',
        // Tiled
        '.tmx',
        '.tmj',
        '.tsx',
        '.tsj',
        // LDtk
        '.ldtk',
        '.ldtkl',
        // Aseprite
        '.aseprite',
        '.ase',
        // OGMO
        '.ogmo',
        // RPG Maker
        '.json', // Map*.json
        // GameMaker
        '.yy',
        '.yyp',
        // Spine
        '.skel',
        '.atlas',
        // DragonBones
        '_ske.json',
        '_tex.json',
        // Live2D
        '.model3.json',
        '.moc3',
        '.physics3.json',
        '.pose3.json',
        '.exp3.json',
        '.motion3.json',
        // Spriter
        '.scml',
        '.scon',
    ];
}
/**
 * Get supported formats info
 */
function getSupportedFormats() {
    return [
        {
            name: 'Nice2Dev',
            type: 'native',
            extensions: ['.ndg', '.ndgp', '.ndga'],
            description: 'Native scene format with full feature support',
        },
        {
            name: 'Unity',
            type: 'unity',
            extensions: ['.unity', '.prefab'],
            description: 'Unity scene and prefab files',
        },
        {
            name: 'Godot',
            type: 'godot',
            extensions: ['.tscn', '.tres'],
            description: 'Godot 4.x scene and resource files',
        },
        {
            name: 'Tiled',
            type: 'tiled',
            extensions: ['.tmx', '.tmj', '.tsx', '.tsj'],
            description: 'Tiled Map Editor files',
        },
        {
            name: 'LDtk',
            type: 'ldtk',
            extensions: ['.ldtk', '.ldtkl'],
            description: 'LDtk Level Designer Toolkit files',
        },
        {
            name: 'Aseprite',
            type: 'aseprite',
            extensions: ['.aseprite', '.ase'],
            description: 'Aseprite sprite and animation files',
        },
        {
            name: 'OGMO',
            type: 'ogmo',
            extensions: ['.ogmo'],
            description: 'OGMO Editor 3 level files',
        },
        {
            name: 'RPG Maker',
            type: 'rpgmaker',
            extensions: ['Map*.json', 'Tilesets.json'],
            description: 'RPG Maker MV/MZ map files',
        },
        {
            name: 'GameMaker',
            type: 'gamemaker',
            extensions: ['.yy', '.yyp'],
            description: 'GameMaker Studio 2 room files',
        },
        {
            name: 'Spine',
            type: 'spine',
            extensions: ['.json', '.skel', '.atlas'],
            description: 'Spine skeletal animation files',
        },
        {
            name: 'DragonBones',
            type: 'dragonbones',
            extensions: ['*_ske.json', '*_tex.json'],
            description: 'DragonBones skeletal animation files',
        },
        {
            name: 'Live2D',
            type: 'live2d',
            extensions: ['.model3.json', '.moc3', '.physics3.json', '.motion3.json'],
            description: 'Live2D Cubism model files',
        },
        {
            name: 'Spriter',
            type: 'spriter',
            extensions: ['.scml', '.scon'],
            description: 'Spriter Pro animation files',
        },
    ];
}

exports.UnitySceneImporter = UnitySceneImporter.UnitySceneImporter;
exports.GodotSceneImporter = GodotSceneImporter.GodotSceneImporter;
exports.TiledMapImporter = TiledMapImporter.TiledMapImporter;
exports.LDtkImporter = LDtkImporter.LDtkImporter;
exports.AsepriteImporter = AsepriteImporter.AsepriteImporter;
exports.OgmoImporter = OgmoImporter.OgmoImporter;
exports.createOgmoImporter = OgmoImporter.createOgmoImporter;
exports.RPGMakerImporter = RPGMakerImporter.RPGMakerImporter;
exports.createRPGMakerImporter = RPGMakerImporter.createRPGMakerImporter;
exports.GameMakerImporter = GameMakerImporter.GameMakerImporter;
exports.createGameMakerImporter = GameMakerImporter.createGameMakerImporter;
exports.SpineImporter = SpineImporter.SpineImporter;
exports.createSpineImporter = SpineImporter.createSpineImporter;
exports.DragonBonesImporter = DragonBonesImporter.DragonBonesImporter;
exports.createDragonBonesImporter = DragonBonesImporter.createDragonBonesImporter;
exports.Live2DImporter = Live2DImporter.Live2DImporter;
exports.createLive2DImporter = Live2DImporter.createLive2DImporter;
exports.SpriterImporter = SpriterImporter.SpriterImporter;
exports.createSpriterImporter = SpriterImporter.createSpriterImporter;
exports.NdgBidirectionalSync = NdgFormat.NdgBidirectionalSync;
exports.NdgExporter = NdgFormat.NdgExporter;
exports.NdgImporter = NdgFormat.NdgImporter;
exports.createBidirectionalSync = NdgFormat.createBidirectionalSync;
exports.createNdgExporter = NdgFormat.createNdgExporter;
exports.createNdgImporter = NdgFormat.createNdgImporter;
exports.ndgToScene = NdgFormat.ndgToScene;
exports.sceneToNdg = NdgFormat.sceneToNdg;
exports.canImport = canImport;
exports.createImporter = createImporter;
exports.createNativeImporter = createNativeImporter;
exports.getImporterForFile = getImporterForFile;
exports.getSupportedExtensions = getSupportedExtensions;
exports.getSupportedFormats = getSupportedFormats;
//# sourceMappingURL=index.js.map
