2021-10-20 18:40:43 +03:00
|
|
|
/** @typedef {import('../models/OfferCode')} OfferCode */
|
2021-10-07 17:42:56 +03:00
|
|
|
|
2021-10-05 17:24:47 +03:00
|
|
|
/**
|
|
|
|
* @typedef {object} OfferCodeChangeEventData
|
|
|
|
* @prop {string} offerId
|
2021-10-08 14:02:22 +03:00
|
|
|
* @prop {OfferCode} previousCode
|
2021-10-07 17:42:56 +03:00
|
|
|
* @prop {OfferCode} currentCode
|
2021-10-05 17:24:47 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
class OfferCodeChangeEvent {
|
|
|
|
/**
|
|
|
|
* @param {OfferCodeChangeEventData} data
|
|
|
|
* @param {Date} timestamp
|
|
|
|
*/
|
|
|
|
constructor(data, timestamp) {
|
|
|
|
this.data = data;
|
|
|
|
this.timestamp = timestamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {OfferCodeChangeEventData} data
|
|
|
|
* @param {Date} [timestamp]
|
|
|
|
*/
|
|
|
|
static create(data, timestamp) {
|
|
|
|
return new OfferCodeChangeEvent(data, timestamp || new Date);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = OfferCodeChangeEvent;
|