"use strict";
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"));
const datasets_1 = __importDefault(require("../datasets/datasets"));
const environments_1 = __importDefault(require("../environments/environments"));
const environmentTypes_1 = __importDefault(require("../environmentTypes/environmentTypes"));
const sshKeys_1 = __importDefault(require("../sshKeys/sshKeys"));
class Project extends resource_1.default {
    constructor(id, clientSession, parentApi) {
        super(clientSession, 'project', id, parentApi);
        this._clientSession = clientSession;
    }
    async assignUserToProject(userId, requestBody) {
        return this._axiosInstance.post(`${this._api}/users/${userId}/relationships`, requestBody);
    }
    async removeUserFromProject(userId) {
        return this._axiosInstance.delete(`${this._api}/users/${userId}/relationships`);
    }
    async listUsersForProject(role, pageSize = 50, paginationToken) {
        return this._axiosInstance.get(`${this._api}/users`, { params: { role, pageSize, paginationToken } });
    }
    environments() {
        return new environments_1.default(this._clientSession, this._id);
    }
    environmentTypes() {
        return new environmentTypes_1.default(this._clientSession, this._api);
    }
    dataSets() {
        return new datasets_1.default(this._clientSession, this._api);
    }
    sshKeys() {
        return new sshKeys_1.default(this._clientSession, this._api);
    }
    async cleanup() {
        try {
            await this.delete();
        }
        catch (e) {
            console.error(`Could not delete project ${this._id}". 
        Encountered error: ${e}`);
        }
    }
}
exports.default = Project;
//# sourceMappingURL=project.js.map