import type { ApiPropertyOptions } from '@nestjs/swagger' ; import { ApiProperty } from '@nestjs/swagger' ; import { getVariableName } from '../common/utils' ; export function ApiBooleanProperty ( options = { } ) { return ApiProperty ( { type : Boolean , ... options } ) ; } export function ApiBooleanPropertyOptional ( options = { } ) { return ApiBooleanProperty ( { required : false , ... options } ) ; } export function ApiUUIDProperty ( options = { } ) { return ApiProperty ( { type : options ?. each ? [ String ] : String , format : 'uuid' , isArray : options ?. each , ... options , } ) ; } export function ApiUUIDPropertyOptional ( options = { } ) { return ApiUUIDProperty ( { required : false , ... options } ) ; } export function ApiEnumProperty < TEnum > ( getEnum , options = { } ) { const enumValue = getEnum ( ) as any ; return ApiProperty ( { type : 'enum' , enum : enumValue , enumName : getVariableName ( getEnum ) , ... options , } ) ; } export function ApiEnumPropertyOptional < TEnum > ( getEnum , options = { } ) { return ApiEnumProperty ( getEnum , { required : false , ... options } ) ; }