import { ApiProperty } from '@nestjs/swagger';
import {
  ApiFilterParamsDecorator,
  ApiGetListParams,
} from '../../common/types/api-filter-params';
import {
  FilterProp,
  FilterPropTypes,
} from '../../common/types/filter-prop-decorators';
import {
  IsEmail,
  IsObject,
  IsOptional,
  IsString,
  IsUUID,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { AssetProps } from '../../asset/logic/Props';

export class NotificationDTO {
  @ApiProperty({ required: true })
  id: string;
  @ApiProperty({})
  projectId: string;
  @ApiProperty({})
  createdAt: Date;
  @ApiProperty({})
  viewedAt: Date;
  @ApiProperty({})
  content: AssetProps;
  @ApiProperty({})
  userId: number;
}

export class NotificationQueryDTOWhere {
  @ApiProperty({})
  @IsOptional()
  @IsUUID(undefined, { each: true })
  ids?: string[];
}

export class NotificationReadRequest {
  @ApiProperty({ type: () => NotificationQueryDTOWhere })
  @IsObject()
  @Type(() => NotificationQueryDTOWhere)
  @ValidateNested()
  where: NotificationQueryDTOWhere;
}

export class NotificationReadResultDTO {
  @ApiProperty({})
  unreadNotificationsCount: number;
}

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

  @ApiProperty({
    description: 'Start from offset',
    required: false,
  })
  @IsOptional()
  offset?: number;
}
