"use strict";
/*
 *
 * Copyright 2018-present NEM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MosaicSupplyChangeActionValidator = exports.LinkActionValidator = exports.ActionValidator = void 0;
const symbol_sdk_1 = require("symbol-sdk");
const action_enum_1 = require("../models/action.enum");
/**
 * Action validator
 */
class ActionValidator {
    /**
     * Validates if an action is valid.
     * @param {string} value - Action type.
     * @returns {true | string}
     */
    validate(value) {
        const keys = Object.keys(action_enum_1.ActionType).filter((key) => Number.isNaN(parseFloat(key)));
        return keys.includes(value) ? true : 'ActionType must be one of (' + keys + ')';
    }
}
exports.ActionValidator = ActionValidator;
/**
 * LinkAction validator
 */
class LinkActionValidator {
    /**
     * Validates if a link action is valid.
     * @param {string} value - LinkAction type.
     * @returns {true | string}
     */
    validate(value) {
        const keys = Object.keys(symbol_sdk_1.LinkAction).filter((key) => Number.isNaN(parseFloat(key)));
        return keys.includes(value) ? true : 'LinkAction must be one of (' + keys + ').';
    }
}
exports.LinkActionValidator = LinkActionValidator;
class MosaicSupplyChangeActionValidator {
    /**
     * Validates if a mosaic supply change action is valid.
     * @param {string} value - MosaicSupplyChangeAction type.
     * @returns {true | string}
     */
    validate(value) {
        const keys = Object.keys(symbol_sdk_1.MosaicSupplyChangeAction).filter((key) => Number.isNaN(parseFloat(key)));
        return keys.includes(value) ? true : 'MosaicSupplyChangeAction must be one of (' + keys + ').';
    }
}
exports.MosaicSupplyChangeActionValidator = MosaicSupplyChangeActionValidator;
