// ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as departmentErrors from '../../errors/department-errors.js'; import * as utilityEngine from '@xyz.warpmatter.com/utility-engine'; // ╔═══════╗╔═══════╗ // ╚══╗ ╔══╝╚╗ ╔══╗ ║ // ║ ║ ║ ║ ║ ║ // ║ ║ ║ ║ ║ ║ // ╔══╝ ╚══╗╔╝ ╚══╝ ║ // ╚═══════╝╚═══════╝ export function validateDepartmentIds( values: any[], minimumCount?: number, maximumCount?: number, ) { if (!areValidDepartmentIds(values, minimumCount, maximumCount)) { departmentErrors.throwInvalidAbsorbLmsDepartmentIdError(); } } export function validateDepartmentId( value: any, ) { if (!isValidDepartmentId(value)) { departmentErrors.throwInvalidAbsorbLmsDepartmentIdError(); } } export function areValidDepartmentIds( values: any[], minimumCount?: number, maximumCount?: number, ): values is string[] { return utilityEngine.isArray(values, minimumCount, maximumCount) && values.every(isValidDepartmentId); } export function isValidDepartmentId( value: any, ): value is string { return utilityEngine.isFilledString(value); }