import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsString, MaxLength, MinLength } from 'class-validator';

export class LoginDto {
  @ApiProperty({ example: 'igor@exemplo.com' })
  @IsEmail({}, { message: 'e-mail inválido' })
  @MaxLength(254)
  email!: string;

  @ApiProperty({ writeOnly: true })
  @IsString()
  @MaxLength(128)
  password!: string;
}

export class RefreshDto {
  @ApiProperty()
  @IsString()
  @MinLength(10)
  @MaxLength(200)
  refreshToken!: string;
}

export class TokensResponse {
  @ApiProperty({ description: 'validade curta (15 min)' })
  accessToken!: string;

  @ApiProperty({ description: 'validade longa (90 dias), revogável no logout' })
  refreshToken!: string;
}
