import {
  IsString,
  IsOptional,
  IsNumber,
  IsDateString,
  MaxLength,
  Min,
  Max,
} from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';

export class ProjectRequestDto {
  @ApiPropertyOptional({ description: 'Freitext / Projektbeschreibung' })
  @IsOptional()
  @IsString()
  notes?: string;

  @ApiPropertyOptional({
    description: 'Auslastung in % (0–100)',
    minimum: 0,
    maximum: 100,
  })
  @IsOptional()
  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0)
  @Max(100)
  workload?: number;

  @ApiPropertyOptional({ format: 'date-time', description: 'Projektstart' })
  @IsOptional()
  @IsDateString()
  startDate?: string;

  @ApiPropertyOptional({
    description: 'Laufzeit (Freitext, z.B. "6 Monate")',
    maxLength: 200,
  })
  @IsOptional()
  @IsString()
  @MaxLength(200)
  duration?: string;

  @ApiPropertyOptional({
    description: 'Vorort-Anteil in % (0–100)',
    minimum: 0,
    maximum: 100,
  })
  @IsOptional()
  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0)
  @Max(100)
  onsitePercent?: number;

  @ApiPropertyOptional({
    description: 'Stundensatz Remote (€/h)',
    minimum: 0,
  })
  @IsOptional()
  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0)
  rateRemote?: number;

  @ApiPropertyOptional({
    description: 'Stundensatz Vorort (€/h)',
    minimum: 0,
  })
  @IsOptional()
  @IsNumber({ maxDecimalPlaces: 2 })
  @Min(0)
  rateOnsite?: number;
}
