// Knox 임직원/조직 코드 → 한글 설명 매핑 // 가이드의 Note 컬럼을 하드코딩해두었다. const CODE_MAPS = { accountStatus: { A: '아이디 승인', W: '아이디 신청', M: '아이디 미발급', }, defaultCompanyCode: { O: '원소속', S: '파견소속', }, employeeStatus: { B: '재직', V: '휴직', }, employeeType: { N: '정규직 (@samsung.com)', U: '협력직', C: '자회사', T: '임시직 (@partner.samsung.com)', X: '협력직 (@samsung.com)', Y: '자회사 (@samsung.com)', Z: '임시직 (@samsung.com)', }, gradeTitleIndiCode: { G: '직위', T: '직급', B: '직위/직급 모두', }, securityLevel: { '1': '회장단', '2': '사장단', '3': '임원진', '4': '간부', '5': '사원', '9': '협력사 임직원', }, executiveYn: { Y: '임원', N: '직원', }, realNameYn: { R: '실명', V: '가명', }, localStaffYn: { Y: '현채인', N: '현채인 아님', }, serverLocation: { KR: '한국', GB: '구주', US: '미주', }, } as const; type CodeField = keyof typeof CODE_MAPS; type CodeValue = keyof (typeof CODE_MAPS)[F]; /** * 개별 코드 설명 반환 * @param field 코드 필드명 (예: 'accountStatus') * @param code 코드 값 (예: 'A') * @returns 한글 설명 (없으면 undefined) */ export function getCodeDescription( field: F, code: CodeValue | string | undefined | null, ): string | undefined { if (!code) return undefined; // 대소문자 구분 없음 처리 const normalized = String(code).toUpperCase() as CodeValue; const map = CODE_MAPS[field] as Record; return map[normalized as string]; } /** * Employee 객체에 *_Desc 필드로 설명을 붙여 반환 * (원본 객체는 수정하지 않음) */ export function withCodeDescriptions>(employee: T) { const result: Record = { ...employee }; (Object.keys(CODE_MAPS) as CodeField[]).forEach((field) => { if (field in employee) { const desc = getCodeDescription(field, employee[field] as string); if (desc) result[`${field}Desc`] = desc; } }); return result as T & { [K in `${CodeField}Desc`]?: string }; } // export 전체 매핑이 필요하면 아래 내보내기 export { CODE_MAPS };