"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compoundTypeKinds = exports.primitiveValueTypeKinds = exports.namingFunction = void 0;
exports.isValueType = isValueType;
exports.canOmitEmpty = canOmitEmpty;
const Naming_js_1 = require("../../Naming.js");
const Strings_js_1 = require("../../support/Strings.js");
exports.namingFunction = (0, Naming_js_1.funPrefixNamer)("namer", goNameStyle);
const legalizeName = (0, Strings_js_1.legalizeCharacters)(Strings_js_1.isLetterOrUnderscoreOrDigit);
function goNameStyle(original) {
    const words = (0, Strings_js_1.splitIntoWords)(original);
    return (0, Strings_js_1.combineWords)(words, legalizeName, Strings_js_1.firstUpperWordStyle, Strings_js_1.firstUpperWordStyle, Strings_js_1.allUpperWordStyle, Strings_js_1.allUpperWordStyle, "", Strings_js_1.isLetterOrUnderscore);
}
exports.primitiveValueTypeKinds = [
    "integer",
    "double",
    "bool",
    "string",
];
exports.compoundTypeKinds = ["array", "class", "map", "enum"];
function isValueType(t) {
    const kind = t.kind;
    return (exports.primitiveValueTypeKinds.includes(kind) ||
        kind === "class" ||
        kind === "enum" ||
        kind === "date-time");
}
function canOmitEmpty(cp, omitEmptyOption) {
    if (!cp.isOptional)
        return false;
    if (omitEmptyOption)
        return true;
    const t = cp.type;
    return !["union", "null", "any"].includes(t.kind);
}
