import { IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';
import { AttendanceDeviceStatus } from '../../entities/attendance-device.entity';

export class CreateAttendanceDeviceDto {
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  deviceSn: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  deviceName: string;

  @IsInt()
  classroomId: number;

  @IsOptional()
  @IsEnum(AttendanceDeviceStatus)
  status?: AttendanceDeviceStatus;

  @IsOptional()
  @IsString()
  @MaxLength(200)
  location?: string;

  @IsOptional()
  @IsString()
  notes?: string;
}

export class UpdateAttendanceDeviceDto {
  @IsOptional()
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  deviceSn?: string;

  @IsOptional()
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  deviceName?: string;

  @IsOptional()
  @IsInt()
  classroomId?: number;

  @IsOptional()
  @IsEnum(AttendanceDeviceStatus)
  status?: AttendanceDeviceStatus;

  @IsOptional()
  @IsString()
  @MaxLength(200)
  location?: string;

  @IsOptional()
  @IsString()
  notes?: string;
}
