UNPKG

@anpdgovbr/shared-types

Version:

Biblioteca central de tipos TypeScript compartilhados para os projetos da ANPD (BETA)

50 lines (49 loc) 1.67 kB
"use strict"; /** * @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 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SETOR_EMPRESARIAL_VALUES = exports.SetorEmpresarial = void 0; exports.isSetorEmpresarial = isSetorEmpresarial; exports.assertSetorEmpresarial = assertSetorEmpresarial; exports.coerceSetorEmpresarial = coerceSetorEmpresarial; /** * Enumeração que representa o setor empresarial de um controlador. * * @public */ 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 || (exports.SetorEmpresarial = SetorEmpresarial = {})); exports.SETOR_EMPRESARIAL_VALUES = [ SetorEmpresarial.PUBLICO, SetorEmpresarial.PRIVADO, ]; const SETOR_EMPRESARIAL_SET = new Set(exports.SETOR_EMPRESARIAL_VALUES); function isSetorEmpresarial(value) { return typeof value === "string" && SETOR_EMPRESARIAL_SET.has(value); } function assertSetorEmpresarial(value) { if (!isSetorEmpresarial(value)) throw new Error(`SetorEmpresarial inválido: ${String(value)}`); } function coerceSetorEmpresarial(value, fallback = SetorEmpresarial.PRIVADO) { return isSetorEmpresarial(value) ? value : fallback; }