import { ApiProperty } from '@nestjs/swagger';
import { IsOptional } from 'class-validator';
import { AssetCreateDTO } from './asset-change-dto';
import { UserWithNameDTO } from '../../user/dto/user-name-dto';

export class AssetHistoryDTO {
  @ApiProperty()
  id: string;

  @ApiProperty({ type: AssetCreateDTO })
  undo: AssetCreateDTO;

  @ApiProperty({ type: AssetCreateDTO })
  redo: AssetCreateDTO;

  @ApiProperty({ type: UserWithNameDTO })
  user: UserWithNameDTO;

  @ApiProperty()
  createdAt: string;
}

export class AssetHistoryQueryDTO {
  @ApiProperty({
    description: 'Limit to count',
    required: false,
  })
  @IsOptional()
  count?: number;
}
