"use strict";
/*
 *  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *  SPDX-License-Identifier: Apache-2.0
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const resource_1 = __importDefault(require("../base/resource"));
class User extends resource_1.default {
    constructor(id, clientSession, parentApi) {
        super(clientSession, 'user', id, parentApi);
    }
    async activate() {
        return this._axiosInstance.patch(this._api, { status: 'ACTIVE' });
    }
    async deactivate() {
        return this._axiosInstance.patch(this._api, { status: 'INACTIVE' });
    }
    async cleanup() {
        const adminSession = await this._setup.getDefaultAdminSession();
        try {
            console.log(`Attempting to make user inactive ${this._id}.`);
            await adminSession.resources.users.user(this._id).update({ status: 'INACTIVE' }, true);
            console.log(`Attempting to delete user ${this._id}.`);
            await adminSession.resources.users.user(this._id).purge();
            console.log(`Deleted user ${this._id}`);
        }
        catch (e) {
            console.warn(`Could not delete user ${this._id}". 
        Encountered error: ${e}`);
        }
    }
}
exports.default = User;
//# sourceMappingURL=user.js.map