import CompareBase from "../Database/CompareBase";
import OneUptimeDate from "../Date";
import BadDataException from "../Exception/BadDataException";
import { ObjectType } from "../JSON";
export default class LessThanOrNull extends CompareBase {
    constructor(value) {
        super(value);
    }
    toJSON() {
        return {
            _type: ObjectType.LessThanOrNull,
            value: this.toString(),
        };
    }
    toString() {
        let value = this.value;
        if (value instanceof Date) {
            value = OneUptimeDate.asDateForDatabaseQuery(value);
        }
        return value.toString();
    }
    static fromJSON(json) {
        if (json["_type"] === ObjectType.LessThanOrNull) {
            return new LessThanOrNull(json["value"]);
        }
        throw new BadDataException("Invalid JSON: " + JSON.stringify(json));
    }
}
//# sourceMappingURL=LessThanOrNull.js.map