import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString, IsUUID, Length, Matches } from 'class-validator';

const FECHA_RE = /^\d{4}-\d{2}-\d{2}$/;

export class ProcesarNovedadesPresentismoDto {
  @ApiProperty({ example: '2026-05-01' })
  @IsString()
  @Matches(FECHA_RE, { message: 'fecha_desde debe ser YYYY-MM-DD' })
  fecha_desde!: string;

  @ApiProperty({ example: '2026-05-31' })
  @IsString()
  @Matches(FECHA_RE, { message: 'fecha_hasta debe ser YYYY-MM-DD' })
  fecha_hasta!: string;

  @ApiPropertyOptional({ description: 'Filtrar por sucursal específica', format: 'uuid' })
  @IsOptional()
  @IsUUID()
  sucursal_id?: string;
}

export class AnularNovedadPresentismoDto {
  @ApiPropertyOptional({ example: 'Corrección manual validada por RRHH.' })
  @IsOptional()
  @IsString()
  @Length(3, 500)
  motivo?: string;
}
