"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OfferState = void 0;
exports.getOfferStatus = getOfferStatus;
var OfferState;
(function (OfferState) {
    OfferState["VOIDED"] = "VOIDED";
    OfferState["NOT_YET_VALID"] = "NOT YET VALID";
    OfferState["EXPIRED"] = "EXPIRED";
    OfferState["VALID"] = "VALID";
})(OfferState || (exports.OfferState = OfferState = {}));
function getOfferStatus(offer) {
    const toTimeStamp = (numberString) => Number(numberString) * 1000;
    const timeNow = Date.now();
    if (offer.voidedAt) {
        return OfferState.VOIDED;
    }
    if (toTimeStamp(offer.validFromDate) > timeNow) {
        return OfferState.NOT_YET_VALID;
    }
    if (toTimeStamp(offer.validUntilDate) < timeNow) {
        return OfferState.EXPIRED;
    }
    return OfferState.VALID;
}
//# sourceMappingURL=getOfferStatus.js.map