@anpdgovbr/shared-types
Version:
Biblioteca central de tipos TypeScript compartilhados para os projetos da ANPD (BETA)
44 lines (43 loc) • 1.36 kB
JavaScript
/**
* @file setor-empresarial.enum.ts
* @module enums
*
* @description
* Define o enum que representa o setor de atuação (público ou privado) de um controlador.
*
* @remarks
* Corresponde ao schema da API Quarkus de Controladores e é utilizado em `ControladorDto`.
*
* @since 0.2.0
*/
/**
* Enumeração que representa o setor empresarial de um controlador.
*
* @public
*/
export var SetorEmpresarial;
(function (SetorEmpresarial) {
/**
* Setor Público (órgãos governamentais, autarquias, etc.).
*/
SetorEmpresarial["PUBLICO"] = "PUBLICO";
/**
* Setor Privado (empresas, organizações não governamentais, etc.).
*/
SetorEmpresarial["PRIVADO"] = "PRIVADO";
})(SetorEmpresarial || (SetorEmpresarial = {}));
export const SETOR_EMPRESARIAL_VALUES = [
SetorEmpresarial.PUBLICO,
SetorEmpresarial.PRIVADO,
];
const SETOR_EMPRESARIAL_SET = new Set(SETOR_EMPRESARIAL_VALUES);
export function isSetorEmpresarial(value) {
return typeof value === "string" && SETOR_EMPRESARIAL_SET.has(value);
}
export function assertSetorEmpresarial(value) {
if (!isSetorEmpresarial(value))
throw new Error(`SetorEmpresarial inválido: ${String(value)}`);
}
export function coerceSetorEmpresarial(value, fallback = SetorEmpresarial.PRIVADO) {
return isSetorEmpresarial(value) ? value : fallback;
}