export default class MediaProfileViewSettings {
    /**
     * @type {boolean}
     */
    hasOpenPlaylist = false;

    /**
     * @type {string}
     */
    playlistPath = null;

    /**
     * @type {number}
     */
    playlistTrackNumber = 0;

    /**
     * @type {number}
     */
    trackPosition = 0;

    /**
     * @param {object} jsonObj 
     * @returns {MediaProfileViewSettings}
     */
    static fromSettingsJson(jsonObj) {
        const settings = new MediaProfileViewSettings();

        if (jsonObj == null) {
            return settings;
        }

        if (jsonObj.hasOpenPlaylist != null) {
            settings.hasOpenPlaylist = jsonObj.hasOpenPlaylist;
        }

        if (jsonObj.playlistPath != null) {
            settings.playlistPath = jsonObj.playlistPath;
        }

        if (jsonObj.playlistTrackNumber != null) {
            settings.playlistTrackNumber = jsonObj.playlistTrackNumber;
        }

        if (jsonObj.trackPosition != null) {
            settings.trackPosition = jsonObj.trackPosition;
        }

        return settings;
    }
}