models/notifications/NotificationBadge.js

export default class NotificationBadge {
    /**
     * @constructor NotificationBadge
     *
     * @param {Object} badgeMap - Content parameters
     * @param {number} [badgeMap.increase] - Increase amount
     * @param {number} [badgeMap.badge] - Number in badge
     */
    constructor (badgeMap) {
        this.increase = badgeMap.increase || null;
        this.badge = badgeMap.badge || null;
    }

    /**
     * Creates badge to increase badge number.
     *
     * @memberof NotificationBadge
     * @param {number} by - Number to increase by.
     * @return {NotificationBadge} New instance.
     */
    static increase(by) {
        return new NotificationBadge({
            increase: by
        });
    }

    /**
     * Creates badge to set badge number.
     *
     * @memberof NotificationBadge
     * @param {number} to - Badge value.
     * @return {NotificationBadge} New instance.
     */
    static set(to) {
        return new NotificationBadge({
            badge: to
        });
    }
}