"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSONSchemaGen = void 0;
class JSONSchemaGen {
    constructor() {
        this.gens = new Map();
    }
    gen(schema) {
        let out = "";
        out += `{\n`;
        out += `  "scopeName": "${schema.scopeName}",\n`;
        out += `  "name": "${schema.name}",\n`;
        out += `  "symbol": "${schema.symbol}",\n`;
        out += `  "schemaURI": "${schema.schemaURI}",\n`;
        out += `  "imageURI": "${schema.imageURI}",\n`;
        if (schema.storage.fields.length > 0) {
            out += `  "fields": [\n`;
        }
        let first = true;
        for (let field of schema.storage.fields) {
            if (!first) {
                out += `,\n`;
            }
            first = false;
            out += `    {\n`;
            out += `      "id": ${field.id},\n`;
            out += `      "key": "${field.key}",\n`;
            out += `      "type": "${field.fieldType}",\n`;
            out += `      "arrayLength": "${field.arrayLength}",\n`;
            out += `      "description": "${field.description}"\n`;
            out += `      "slot": "${field.slot}",\n`;
            out += `      "offset": "${field.offset}",\n`;
            out += `    }`;
        }
        if (schema.storage.fields.length > 0) {
            out += `\n  ]\n`;
        }
        out += `}\n`;
        return out;
    }
}
exports.JSONSchemaGen = JSONSchemaGen;
