import * as i0 from '@angular/core';
import { NgModule, Injectable } from '@angular/core';

class AXPNativeModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                }]
        }] });

var MessageType;
(function (MessageType) {
    MessageType[MessageType["SetDarkMode"] = 0] = "SetDarkMode";
    MessageType[MessageType["CheckNetworkStatus"] = 1] = "CheckNetworkStatus";
    MessageType[MessageType["GetCurrentLocation"] = 2] = "GetCurrentLocation";
    MessageType[MessageType["SetPreferredLanguage"] = 3] = "SetPreferredLanguage";
    MessageType[MessageType["OpenExternalLink"] = 4] = "OpenExternalLink";
    MessageType[MessageType["AuthenticateBiometric"] = 5] = "AuthenticateBiometric";
    MessageType[MessageType["SelectImageFromGallery"] = 6] = "SelectImageFromGallery";
    MessageType[MessageType["SelectImageFromCamera"] = 7] = "SelectImageFromCamera";
    MessageType[MessageType["SelectVideoFromGallery"] = 8] = "SelectVideoFromGallery";
    MessageType[MessageType["SelectVideoFromCamera"] = 9] = "SelectVideoFromCamera";
    MessageType[MessageType["SelectFile"] = 10] = "SelectFile";
})(MessageType || (MessageType = {}));
class AXPNativeService {
    constructor() {
        this.isDark = false;
        if (window.FlutterChannel) {
            window.FlutterChannel.postMessage = (message) => {
                try {
                    const { action, params } = JSON.parse(message);
                    console.log('FlutterChannel action:', action, 'params:', params);
                    switch (action) {
                        case MessageType.SetDarkMode:
                            // this.setDarkMode(params.isDark);
                            break;
                        // Handle other message types as needed
                        default:
                            console.warn('Unhandled message action:', action);
                    }
                }
                catch (error) {
                    console.error('Error parsing message from FlutterChannel:', message, error);
                }
            };
        }
    }
    setDarkMode(isDarkMode) {
        this.isDark = isDarkMode;
        const message = {
            action: MessageType.SetDarkMode,
            params: { isDark: this.isDark },
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    checkNetworkStatus() {
        const message = {
            action: MessageType.CheckNetworkStatus,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    getCurrentLocation() {
        const message = {
            action: MessageType.GetCurrentLocation,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    setPreferredLanguage(language) {
        const message = {
            action: MessageType.SetPreferredLanguage,
            params: { language },
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    openExternalLink(url) {
        const message = {
            action: MessageType.OpenExternalLink,
            params: { url },
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    authenticateBiometric() {
        const message = {
            action: MessageType.AuthenticateBiometric,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    selectImageFromGallery() {
        const message = {
            action: MessageType.SelectImageFromGallery,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    selectImageFromCamera() {
        const message = {
            action: MessageType.SelectImageFromCamera,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    selectVideoFromGallery() {
        const message = {
            action: MessageType.SelectVideoFromGallery,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    selectVideoFromCamera() {
        const message = {
            action: MessageType.SelectVideoFromCamera,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    selectFile() {
        const message = {
            action: MessageType.SelectFile,
            params: {},
        };
        this.sendMessageToFlutter(JSON.stringify(message));
    }
    sendMessageToFlutter(message) {
        if (window.FlutterChannel) {
            window.FlutterChannel.postMessage(message);
        }
        else {
            console.error('FlutterChannel is not defined');
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPNativeService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

/**
 * Generated bundle index. Do not edit.
 */

export { AXPNativeModule, AXPNativeService };
//# sourceMappingURL=acorex-platform-native.mjs.map
