"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ValidatedArgs_1 = __importDefault(require("../../../../core/validation/ValidatedArgs"));
const FormatValidation_1 = __importDefault(require("../FormatValidation"));
const SecurityDate_1 = require("../../../../domain/context/shared/SecurityDate");
const Bond_1 = require("../../../../domain/context/bond/Bond");
class SetCouponRequest extends ValidatedArgs_1.default {
    securityId;
    rate;
    recordTimestamp;
    executionTimestamp;
    startTimestamp;
    endTimestamp;
    fixingTimestamp;
    rateStatus;
    constructor({ securityId, rate, recordTimestamp, executionTimestamp, startTimestamp, endTimestamp, fixingTimestamp, rateStatus, }) {
        super({
            rate: FormatValidation_1.default.checkAmount(true),
            recordTimestamp: (val) => {
                return SecurityDate_1.SecurityDate.checkDateTimestamp(parseInt(val), Math.ceil(new Date().getTime() / 1000), parseInt(this.executionTimestamp));
            },
            executionTimestamp: (val) => {
                return SecurityDate_1.SecurityDate.checkDateTimestamp(parseInt(val), parseInt(this.recordTimestamp), undefined);
            },
            securityId: FormatValidation_1.default.checkHederaIdFormatOrEvmAddress(),
            endTimestamp: (val) => {
                return SecurityDate_1.SecurityDate.checkDateTimestamp(parseInt(val), parseInt(this.startTimestamp), undefined);
            },
            fixingTimestamp: (val) => {
                return SecurityDate_1.SecurityDate.checkDateTimestamp(parseInt(val), undefined, parseInt(this.executionTimestamp));
            },
            rateStatus: (val) => {
                return Bond_1.Bond.checkRateStatus(val);
            },
        });
        this.securityId = securityId;
        this.rate = rate;
        this.recordTimestamp = recordTimestamp;
        this.executionTimestamp = executionTimestamp;
        this.startTimestamp = startTimestamp;
        this.endTimestamp = endTimestamp;
        this.fixingTimestamp = fixingTimestamp;
        this.rateStatus = rateStatus;
    }
}
exports.default = SetCouponRequest;
