import { uuidSchema , stringSchema , timestampSchema , ValidateSchema , ValidationError , SchemaBuilder } from '@mds-core/mds-schema-validators' ; import { CreateJurisdictionDomainModel } from '../@types' ; const createJurisdictionDomainModelSchema = SchemaBuilder . object ( ) . keys ( { jurisdiction_id : uuidSchema . optional ( ) , agency_key : stringSchema , agency_name : stringSchema , geography_id : uuidSchema , timestamp : timestampSchema . optional ( ) } ) ; export const ValidateJurisdictionForCreate = ( jurisdiction ) : CreateJurisdictionDomainModel => { try { ValidateSchema < CreateJurisdictionDomainModel > ( jurisdiction , createJurisdictionDomainModelSchema ) ; return jurisdiction ; } catch ( error ) { throw new ValidationError ( 'Invalid Jurisdiction' , { jurisdiction , error } ) ; } } ;