"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MosaicsValidator = exports.MosaicValidator = void 0;
const mosaic_service_1 = require("../services/mosaic.service");
/**
 * Mosaic validator
 */
class MosaicValidator {
    /**
     * Validates if a mosaic object can be created from a string.
     * @param {string} value - Mosaic in the form mosaicId::amount.
     * @returns {true | string}
     */
    validate(value) {
        return mosaic_service_1.MosaicService.validate(value);
    }
}
exports.MosaicValidator = MosaicValidator;
/**
 * Mosaics validator
 */
class MosaicsValidator {
    /**
     * Validates if an array of mosaic objects can be created from a string.
     * @param {string} value - Mosaics in the form mosaicId::amount, separated by commas.
     * @returns {true | string}
     */
    validate(value) {
        let error = '';
        if (value) {
            const mosaics = value.split(',');
            mosaics.forEach((mosaic) => {
                const validation = mosaic_service_1.MosaicService.validate(mosaic);
                if (typeof validation === 'string') {
                    error = validation;
                }
            });
        }
        return error ? error : true;
    }
}
exports.MosaicsValidator = MosaicsValidator;
