"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IMAPAsyncSession = void 0;
const tslib_1 = require("tslib");
const path = tslib_1.__importStar(require("path"));
// tslint:disable-next-line: no-var-requires
let bindings;
try {
    bindings = require(path.join(__dirname, "../../lib/binding/trusted_mailcore2.node"));
}
catch (e) {
    bindings = require(path.join(__dirname, "../../lib/binding/trusted_mailcore2_no_crypto.node"));
}
// tslint:disable-next-line
const { IMAPAsyncSession: _IMAPAsyncSession } = bindings;
/**
 * IMAPAsyncSession Class
 *
 * @public
 */
class IMAPAsyncSession extends bindings.IMAPAsyncSession {
    constructor() {
        super();
        const handle = new _IMAPAsyncSession();
        this.handle = handle;
    }
    /**
     * Set hostname
     *
     * @memberof IMAPAsyncSession
     */
    set hostname(hostname) {
        this.handle.hostname = hostname;
    }
    /**
     * Get hostname
     *
     * @type {string}
     * @memberof IMAPAsyncSession
     */
    get hostname() {
        return this.handle.hostname;
    }
    /**
     * Set port
     *
     * @memberof IMAPAsyncSession
     */
    set port(port) {
        this.handle.port = port;
    }
    /**
     * Get port
     *
     * @type {number}
     * @memberof IMAPAsyncSession
     */
    get port() {
        return this.handle.port;
    }
    /**
     * Set string
     *
     * @memberof IMAPAsyncSession
     */
    set username(username) {
        this.handle.username = username;
    }
    /**
     * Get string
     *
     * @type {string}
     * @memberof IMAPAsyncSession
     */
    get username() {
        return this.handle.username;
    }
    /**
     * Set password
     *
     * @memberof IMAPAsyncSession
     */
    set password(password) {
        this.handle.password = password;
    }
    /**
     * Get password
     *
     * @type {string}
     * @memberof IMAPAsyncSession
     */
    get password() {
        return this.handle.password;
    }
    /**
     * Set checkCertificateEnabled
     *
     * @memberof IMAPAsyncSession
     */
    set checkCertificateEnabled(isEnabled) {
        this.handle.checkCertificateEnabled = isEnabled;
    }
    /**
     * Get checkCertificateEnabled
     *
     * @type {boolean}
     * @memberof IMAPAsyncSession
     */
    get checkCertificateEnabled() {
        return this.handle.checkCertificateEnabled;
    }
    /**
     * Set OAuth2Token
     *
     * @memberof IMAPAsyncSession
     */
    set OAuth2Token(OAuth2Token) {
        this.handle.OAuth2Token = OAuth2Token;
    }
    /**
     * Get OAuth2Token
     *
     * @type {string}
     * @memberof IMAPAsyncSession
     */
    get OAuth2Token() {
        return this.handle.OAuth2Token;
    }
    /**
     * Set authType
     *
     * @memberof IMAPAsyncSession
     */
    set authType(authType) {
        this.handle.authType = authType;
    }
    /**
     * Get authType
     *
     * @type {AuthType}
     * @memberof IMAPAsyncSession
     */
    get authType() {
        return this.handle.authType;
    }
    /**
     * Set connectionType
     *
     * @memberof IMAPAsyncSession
     */
    set connectionType(connectionType) {
        this.handle.connectionType = connectionType;
    }
    /**
     * Get connectionType
     *
     * @type {ConnectionType}
     * @memberof IMAPAsyncSession
     */
    get connectionType() {
        return this.handle.connectionType;
    }
    /**
     * Set strictGost flag (to force using GOST for TLS)
     *
     * @memberof IMAPSession
     */
    set strictGost(value) {
        this.handle.strictGost = value;
    }
    /**
     * Get strictGost flag (to force using GOST for TLS)
     *
     * @type {Boolean}
     * @memberof IMAPSession
     */
    get strictGost() {
        return this.handle.strictGost;
    }
    /**
     * Validate exist account
     *
     * @param {string} from address
     * @returns {number} 0 - success, other - failure
     *
     * @memberof IMAPAsyncSession
     */
    async checkAccount(from) {
        return this.handle.checkAccount(from);
    }
    /**
     * Disconnect connection
     *
     * @memberof IMAPAsyncSession
     */
    disconnect() {
        this.handle.disconnect();
    }
    /**
     * Validate connection status
     *
     * @returns {boolean}
     *
     * @memberof IMAPAsyncSession
     */
    isDisconnected() {
        return this.handle.isDisconnected();
    }
    fetchAllFolders() {
        return this.handle.fetchAllFolders();
    }
}
exports.IMAPAsyncSession = IMAPAsyncSession;
//# sourceMappingURL=IMAPAsyncSession.js.map