import { IntUnitsOfEnergy } from '@energyweb/origin-backend-utils' ; import { ApiProperty } from '@nestjs/swagger' ; import BN from 'bn.js' ; import { Transform } from 'class-transformer' ; import { IsArray , IsNotEmpty , IsString , Validate } from 'class-validator' ; export class BundleSplitItemDTO { constructor ( item ) { Object . assign ( this , item ) ; } @ ApiProperty ( { type : String } ) id : string ; @ ApiProperty ( { type : String } ) @ IsNotEmpty ( ) @ Validate ( IntUnitsOfEnergy ) @ Transform ( ( v ) => v . toString ( 10 ) ) volume : BN ; } export class BundleSplitVolumeDTO { constructor ( bundleSplitVolume ) { Object . assign ( this , bundleSplitVolume ) ; } @ ApiProperty ( { type : String } ) @ IsNotEmpty ( ) @ Validate ( IntUnitsOfEnergy ) @ Transform ( ( v ) => v . toString ( 10 ) ) volume : BN ; @ ApiProperty ( { type : [ BundleSplitItemDTO ] } ) @ IsArray ( ) items : BundleSplitItemDTO [ ] ; } export class BundleSplitDTO { constructor ( bundleSplits ) { Object . assign ( this , bundleSplits ) ; } @ ApiProperty ( { type : String } ) @ IsNotEmpty ( ) @ IsString ( ) readonly id : string ; @ ApiProperty ( { type : [ BundleSplitVolumeDTO ] } ) @ IsArray ( ) readonly splits : BundleSplitVolumeDTO [ ] ; }