import { funPrefixNamer } from "../../Naming.js";
import { allUpperWordStyle, combineWords, firstUpperWordStyle, isLetterOrUnderscore, isLetterOrUnderscoreOrDigit, legalizeCharacters, splitIntoWords, } from "../../support/Strings.js";
export const namingFunction = funPrefixNamer("namer", goNameStyle);
const legalizeName = legalizeCharacters(isLetterOrUnderscoreOrDigit);
function goNameStyle(original) {
    const words = splitIntoWords(original);
    return combineWords(words, legalizeName, firstUpperWordStyle, firstUpperWordStyle, allUpperWordStyle, allUpperWordStyle, "", isLetterOrUnderscore);
}
export const primitiveValueTypeKinds = [
    "integer",
    "double",
    "bool",
    "string",
];
export const compoundTypeKinds = ["array", "class", "map", "enum"];
export function isValueType(t) {
    const kind = t.kind;
    return (primitiveValueTypeKinds.includes(kind) ||
        kind === "class" ||
        kind === "enum" ||
        kind === "date-time");
}
export function canOmitEmpty(cp, omitEmptyOption) {
    if (!cp.isOptional)
        return false;
    if (omitEmptyOption)
        return true;
    const t = cp.type;
    return !["union", "null", "any"].includes(t.kind);
}
