import { InputGroup } from '../../types';
import { FilterGroup, FilterGroupSchema } from '../schemas';

/**
 * Maps an InputGroup object to a FilterGroup object
 *
 * This function converts a generic InputGroup to a strongly-typed FilterGroup,
 * validating it against a schema. It preserves the group identifier, label,
 * and description.
 *
 * @param group - The source input group to map
 * @returns A validated FilterGroup object
 */
export function filterGroupMapping(group: InputGroup): FilterGroup {
  return FilterGroupSchema.parse({
    group: group.group,
    label: group.label,
    description: group.description,
  });
}
