import { BooleanOption, getOptionValues } from "../../RendererOptions/index.js";
import { TargetLanguage } from "../../TargetLanguage.js";
import { javaScriptOptions } from "../JavaScript/index.js";
import { FlowRenderer } from "./FlowRenderer.js";
import { TypeScriptRenderer } from "./TypeScriptRenderer.js";
export const tsFlowOptions = Object.assign({}, javaScriptOptions, {
    justTypes: new BooleanOption("just-types", "Interfaces only", false),
    nicePropertyNames: new BooleanOption("nice-property-names", "Transform property names to be JavaScripty", false),
    declareUnions: new BooleanOption("explicit-unions", "Explicitly name unions", false),
    preferUnions: new BooleanOption("prefer-unions", "Use union type instead of enum", false),
    preferTypes: new BooleanOption("prefer-types", "Use types instead of interfaces", false),
    preferConstValues: new BooleanOption("prefer-const-values", "Use string instead of enum for string enums with single value", false),
    readonly: new BooleanOption("readonly", "Use readonly type members", false),
});
export const typeScriptLanguageConfig = {
    displayName: "TypeScript",
    names: ["typescript", "ts", "tsx"],
    extension: "ts",
};
export class TypeScriptTargetLanguage extends TargetLanguage {
    constructor() {
        super(typeScriptLanguageConfig);
    }
    getOptions() {
        return 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(this, renderContext, getOptionValues(tsFlowOptions, untypedOptionValues));
    }
}
export const flowLanguageConfig = {
    displayName: "Flow",
    names: ["flow"],
    extension: "js",
};
export class FlowTargetLanguage extends TargetLanguage {
    constructor() {
        super(flowLanguageConfig);
    }
    getOptions() {
        return 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(this, renderContext, getOptionValues(tsFlowOptions, untypedOptionValues));
    }
}
