"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowTargetLanguage = exports.flowLanguageConfig = exports.TypeScriptTargetLanguage = exports.typeScriptLanguageConfig = exports.tsFlowOptions = void 0;
const index_js_1 = require("../../RendererOptions/index.js");
const TargetLanguage_js_1 = require("../../TargetLanguage.js");
const index_js_2 = require("../JavaScript/index.js");
const FlowRenderer_js_1 = require("./FlowRenderer.js");
const TypeScriptRenderer_js_1 = require("./TypeScriptRenderer.js");
exports.tsFlowOptions = Object.assign({}, index_js_2.javaScriptOptions, {
    justTypes: new index_js_1.BooleanOption("just-types", "Interfaces only", false),
    nicePropertyNames: new index_js_1.BooleanOption("nice-property-names", "Transform property names to be JavaScripty", false),
    declareUnions: new index_js_1.BooleanOption("explicit-unions", "Explicitly name unions", false),
    preferUnions: new index_js_1.BooleanOption("prefer-unions", "Use union type instead of enum", false),
    preferTypes: new index_js_1.BooleanOption("prefer-types", "Use types instead of interfaces", false),
    preferConstValues: new index_js_1.BooleanOption("prefer-const-values", "Use string instead of enum for string enums with single value", false),
    readonly: new index_js_1.BooleanOption("readonly", "Use readonly type members", false),
});
exports.typeScriptLanguageConfig = {
    displayName: "TypeScript",
    names: ["typescript", "ts", "tsx"],
    extension: "ts",
};
class TypeScriptTargetLanguage extends TargetLanguage_js_1.TargetLanguage {
    constructor() {
        super(exports.typeScriptLanguageConfig);
    }
    getOptions() {
        return exports.tsFlowOptions;
    }
    get stringTypeMapping() {
        const mapping = new Map();
        const dateTimeType = "date-time";
        mapping.set("date", dateTimeType);
        mapping.set("date-time", dateTimeType);
        return mapping;
    }
    get supportsOptionalClassProperties() {
        return true;
    }
    get supportsFullObjectType() {
        return true;
    }
    makeRenderer(renderContext, untypedOptionValues) {
        return new TypeScriptRenderer_js_1.TypeScriptRenderer(this, renderContext, (0, index_js_1.getOptionValues)(exports.tsFlowOptions, untypedOptionValues));
    }
}
exports.TypeScriptTargetLanguage = TypeScriptTargetLanguage;
exports.flowLanguageConfig = {
    displayName: "Flow",
    names: ["flow"],
    extension: "js",
};
class FlowTargetLanguage extends TargetLanguage_js_1.TargetLanguage {
    constructor() {
        super(exports.flowLanguageConfig);
    }
    getOptions() {
        return exports.tsFlowOptions;
    }
    get stringTypeMapping() {
        const mapping = new Map();
        const dateTimeType = "date-time";
        mapping.set("date", dateTimeType);
        mapping.set("date-time", dateTimeType);
        return mapping;
    }
    get supportsOptionalClassProperties() {
        return true;
    }
    get supportsFullObjectType() {
        return true;
    }
    makeRenderer(renderContext, untypedOptionValues) {
        return new FlowRenderer_js_1.FlowRenderer(this, renderContext, (0, index_js_1.getOptionValues)(exports.tsFlowOptions, untypedOptionValues));
    }
}
exports.FlowTargetLanguage = FlowTargetLanguage;
