import { ApiProperty } from '@nestjs/swagger';
import { IsDateString, IsString, IsUUID, Matches, MaxLength } from 'class-validator';
import { ErrorCode } from '../../../common/errors';

export class CreateAppointmentDto {
  @ApiProperty()
  @IsUUID()
  patientId: string;

  @ApiProperty({ description: 'Staff user id (column provider)' })
  @IsUUID()
  providerUserId: string;

  @ApiProperty({ example: '2026-05-06T09:15:00.000Z' })
  @IsDateString()
  startAt: string;

  @ApiProperty({ example: '2026-05-06T09:45:00.000Z' })
  @IsDateString()
  endAt: string;

  @ApiProperty({
    description: 'Treatment type code from the treatment catalog',
    example: 'consultation',
  })
  @IsString()
  @MaxLength(64)
  purpose: string;

  @ApiProperty({
    description:
      'IANA time zone of the booking user (e.g. Asia/Tehran). Wall-clock hours are interpreted in this zone.',
    example: 'Asia/Tehran',
  })
  @IsString()
  @MaxLength(64)
  @Matches(/^[A-Za-z0-9_+\-/]+$/, { message: ErrorCode.VALIDATION_TIMEZONE_INVALID })
  timeZone: string;
}
