import UserIdList from '../UserIdList';
export default class SendNotificationTarget {
/**
* @constructor SendNotificationTarget
*
* @param {Object} targetMap - Target parameters
* @param {UserIdList} [targetMap.userIdList] - User IDs
* @param {string[]} [targetMap.placeholders=[]] - Placeholders
*/
constructor (targetMap) {
this.userIdList = targetMap.userIdList || null;
this.placeholders = targetMap.placeholders || [];
}
/**
* Create a new notification target.
*
* @memberof SendNotificationTarget
* @return {SendNotificationTarget} new instance.
*/
static create() {
return new SendNotificationTarget({});
}
/**
* Create a new notification target with list of users.
*
* @memberof SendNotificationTarget
* @param {UserIdList} userIdList - List of user to receive notification.
* @return {SendNotificationTarget} New instance.
*/
static usersWithIds(userIdList) {
return new SendNotificationTarget({ userIdList });
}
/**
* Add a placeholder.
*
* @memberof SendNotificationTarget
* @instance
* @param {string} placeholder - one of {@link SendNotificationPlaceholders.Receivers}.
* @return {SendNotificationTarget} - Same instance.
*/
addReceiverPlaceholder(placeholder) {
this.placeholders.push(placeholder);
return this;
}
}