models/invites/ReferralUsersQuery.js

import PagingQuery from '../PagingQuery.js';

export default class ReferralUsersQuery {
    /**
     * @constructor ReferralUsersQuery
     * @param {string} event - The event to filter the referral users.
     * @param {number} offset - Number of items to skip from the list.
     * @param {number} limit - Number of items to return.
     */
    constructor(event, offset, limit) {
        this.event = event || null;
        this.offset = offset || null;
        this.limit = limit || PagingQuery.DefaultLimit;
    }

    /**
     * Creates new query to filter all the users.
     *
     * @memberof ReferralUsersQuery
     * @return {ReferralUsersQuery} New ReferralUsersQuery instance.
     */
    static allUsers() {
        return new ReferralUsersQuery(null);
    }

    /**
     * Creates new query to filter users for the specified event.
     *
     * @memberof ReferralUsersQuery
     * @param {string} event - Event name.
     * @return {ReferralUsersQuery} New ReferralUsersQuery instance.
    */
    static usersForEvent(event) {
        return new ReferralUsersQuery(event);
    }

    /**
     * Sets offset.
     *
     * @memberof ReferralUsersQuery
     * @param {number} offset - Number of items to skip from the list.
     * @return {ReferralUsersQuery} Same instance.
    */
    withOffset(offset) {
        this.offset = offset;
        return this;
    }

    /**
     * Sets limit.
     *
     * @memberof ReferralUsersQuery
     * @param {number} limit - Number of items to return.
     * @return {ReferralUsersQuery} Same instance.
    */
     withLimit(limit) {
        this.limit = limit;
        return this;
    }
}