/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { LINEAR_PROGRESS_CONSTANTS } from './linear-progress-constants';
export class LinearProgressFoundation {
    constructor(_adapter) {
        this._adapter = _adapter;
        this._determinate = false;
        this._progress = 0;
        this._buffer = 1;
        this._theme = 'primary';
    }
    initialize() {
        this._adapter.initialize();
    }
    get determinate() {
        return this._determinate;
    }
    set determinate(value) {
        value = Boolean(value);
        if (this._determinate !== value) {
            this._determinate = value;
            this._adapter.setBuffer(this._determinate ? this._buffer : 1);
            this._adapter.setProgress(this._determinate ? this._progress : 0);
            this._adapter.setDeterminate(this._determinate);
            this._adapter.toggleHostAttribute(LINEAR_PROGRESS_CONSTANTS.attributes.DETERMINATE, this._determinate);
        }
    }
    get progress() {
        return this._progress;
    }
    set progress(value) {
        if (this._progress !== value) {
            this._progress = value;
            if (this._determinate) {
                this._adapter.setProgress(this._progress);
            }
            this._adapter.setHostAttribute(LINEAR_PROGRESS_CONSTANTS.attributes.PROGRESS, String(this._progress));
        }
    }
    get buffer() {
        return this._buffer;
    }
    set buffer(value) {
        if (this._buffer !== value) {
            this._buffer = value;
            if (this._determinate) {
                this._adapter.setBuffer(this._buffer);
            }
            this._adapter.setHostAttribute(LINEAR_PROGRESS_CONSTANTS.attributes.BUFFER, this._buffer.toString());
        }
    }
    get theme() {
        return this._theme;
    }
    set theme(value) {
        if (this._theme !== value) {
            this._theme = value;
            this._adapter.toggleHostAttribute(LINEAR_PROGRESS_CONSTANTS.attributes.THEME, !!this._theme, this._theme);
        }
    }
}
