import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger';
import { AssetShortDTO } from './asset-dto';

@ApiExtraModels(AssetShortDTO)
export class AssetsGraphResultObjectsDTO {
  @ApiProperty({
    type: 'object',
    additionalProperties: { $ref: getSchemaPath(AssetShortDTO) },
  })
  assets: {
    [key: string]: AssetShortDTO;
  };
}

export class AssetsGraphResultLinkDTO {
  @ApiProperty()
  source: string;

  @ApiProperty()
  target: string;

  @ApiProperty()
  type: string;
}

export class AssetsGraphResultDTO {
  @ApiProperty({
    type: AssetsGraphResultLinkDTO,
    isArray: true,
  })
  list: AssetsGraphResultLinkDTO[];

  @ApiProperty({ type: AssetsGraphResultObjectsDTO })
  objects: AssetsGraphResultObjectsDTO;

  @ApiProperty()
  more: boolean;
}
