/* eslint-disable @typescript-eslint/unified-signatures */
import { HttpStep } from '../../HttpStep.js';
export const RoundStepKind = 'HttpAction#Round';
/**
 * Formats the input as a number using fixed-point notation.
 */
export class RoundStep extends HttpStep {
    kind = RoundStepKind;
    /**
     * The number of digits to appear after the decimal point; should be a value between 0 and 100, inclusive.
     * If this argument is omitted, it is treated as 0.
     * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed.
     */
    precision;
    constructor(precisionOrInit) {
        super();
        if (typeof precisionOrInit === 'object') {
            const typed = precisionOrInit;
            this.new(typed);
        }
        else if (typeof precisionOrInit === 'number') {
            this.new({
                kind: RoundStepKind,
                precision: precisionOrInit,
                enabled: true,
            });
        }
    }
    new(init) {
        super.new(init);
        this.kind = RoundStepKind;
        if (typeof init.precision === 'number') {
            this.precision = init.precision;
        }
        else {
            this.precision = undefined;
        }
    }
    checkValidity() {
        return true;
    }
    toJSON() {
        const result = {
            ...super.toJSON(),
            kind: RoundStepKind,
        };
        if (typeof this.precision === 'number') {
            result.precision = this.precision;
        }
        return result;
    }
}
//# sourceMappingURL=RoundStep.js.map