"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@angular/core");
const material_1 = require("@angular/material");
const BehaviorSubject_1 = require("rxjs/BehaviorSubject");
var State;
(function (State) {
    State[State["LoggingIn"] = 0] = "LoggingIn";
    State[State["Approving"] = 1] = "Approving";
})(State = exports.State || (exports.State = {}));
/**
 * The Launch Dialog prompts the user to log in, and connect to Interactive
 * for them. It calls back with connection details, or undefined if the dialog
 * was dismissed beforehand.
 */
let UploadSchemaDialogComponent = class UploadSchemaDialogComponent {
    constructor(dialogRef) {
        this.dialogRef = dialogRef;
        /**
         * Exposed State enum for the template to consume.
         */
        this.State = State; // tslint:disable-line
        /**
         * Curre state of the component.
         */
        this.state = new BehaviorSubject_1.BehaviorSubject(State.LoggingIn);
        /**
         * Model for the "don't show this again" checkbox.
         */
        this.dontShowAgain = false;
    }
    onLoggedIn() {
        this.state.next(State.Approving);
    }
    onSelected(approved) {
        this.dialogRef.close({
            approved,
            dontShowAgain: this.dontShowAgain,
        });
    }
};
UploadSchemaDialogComponent = __decorate([
    core_1.Component({
        selector: 'upload-schema-dialog',
        templateUrl: './upload-schema-dialog.component.html',
        styleUrls: ['../dialog.scss'],
        changeDetection: core_1.ChangeDetectionStrategy.OnPush,
    }),
    __metadata("design:paramtypes", [material_1.MatDialogRef])
], UploadSchemaDialogComponent);
exports.UploadSchemaDialogComponent = UploadSchemaDialogComponent;
