{"size": 1956, "ext": "js", "max_stars_repo_path": "node_modules/symbol-sdk/dist/src/model/mosaic/MosaicFlags.js", "max_stars_repo_name": "ran-li2002/minty-server", "max_stars_repo_stars_event_min_datetime": "2021-06-21T15:09:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-21T15:09:31.000Z", "max_issues_repo_path": "node_modules/symbol-sdk/dist/src/model/mosaic/MosaicFlags.js", "max_issues_repo_name": "ran-li2002/minty-server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/symbol-sdk/dist/src/model/mosaic/MosaicFlags.js", "max_forks_repo_name": "ran-li2002/minty-server", "max_forks_repo_forks_event_min_datetime": "2021-04-22T01:19:22.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-22T01:19:22.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 31.0476190476, "max_line_length": 104, "alphanum_fraction": 0.6257668712}
"use strict";
/*
 * Copyright 2018 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.MosaicFlags = void 0;
/**
 * Mosaic flags model
 */
class MosaicFlags {
    /**
     * @param flags
     * @param divisibility
     * @param duration
     */
    constructor(flags) {
        let binaryFlags = '00' + (flags >>> 0).toString(2);
        binaryFlags = binaryFlags.substr(binaryFlags.length - 3, 3);
        this.supplyMutable = binaryFlags[2] === '1';
        this.transferable = binaryFlags[1] === '1';
        this.restrictable = binaryFlags[0] === '1';
    }
    /**
     * Static constructor function with default parameters
     * @returns {MosaicFlags}
     * @param supplyMutable
     * @param transferable
     * @param restrictable
     */
    static create(supplyMutable, transferable, restrictable = false) {
        const flags = (supplyMutable ? 1 : 0) + (transferable ? 2 : 0) + (restrictable ? 4 : 0);
        return new MosaicFlags(flags);
    }
    /**
     * Get mosaic flag value in number
     * @returns {number}
     */
    getValue() {
        return (this.supplyMutable ? 1 : 0) + (this.transferable ? 2 : 0) + (this.restrictable ? 4 : 0);
    }
    /**
     * Create DTO object
     */
    toDTO() {
        return {
            flags: this.getValue(),
        };
    }
}
exports.MosaicFlags = MosaicFlags;
//# sourceMappingURL=MosaicFlags.js.map