import { PartialType } from '@nestjs/mapped-types';
import { IsOptional, IsString, IsNumber, IsDateString, IsNotEmpty, Min } from 'class-validator';

export class UpsertProfileDto {
  @IsOptional() @IsString() targetCollege?: string;
  @IsOptional() @IsString() targetMajor?: string;
  @IsOptional() @IsString() collegeSchool?: string;
  @IsOptional() @IsString() collegeMajor?: string;
  @IsOptional() @IsString() subjectDirection?: string;
  @IsOptional() @IsString() grade?: string;
  @IsOptional() @IsDateString() profileDate?: string;
  @IsOptional() @IsString() notes?: string;
}

export class CreateEnrollmentDto {
  @IsString() @IsNotEmpty() courseCategory: string;
  @IsString() @IsNotEmpty() classType: string;
  @IsOptional() @IsString() className?: string;
  @IsOptional() @IsString() headTeacher?: string;
  @IsOptional() @IsString() subjectTeacher?: string;
  @IsOptional() @IsDateString() startDate?: string;
  @IsOptional() @IsDateString() endDate?: string;
  @IsOptional() @IsString() status?: string;
}

export class UpdateEnrollmentDto extends PartialType(CreateEnrollmentDto) {}

export class CreateExamScoreDto {
  @IsString() @IsNotEmpty() examType: string;
  @IsOptional() @IsString() examName?: string;
  @IsString() @IsNotEmpty() subject: string;
  @IsNumber() @Min(0) score: number;
  @IsOptional() @IsNumber() @Min(0) classAvg?: number;
  @IsOptional() @IsNumber() @Min(1) rank?: number;
  @IsOptional() @IsDateString() examDate?: string;
  @IsOptional() @IsNumber() enrollmentId?: number;
}

export class UpdateExamScoreDto extends PartialType(CreateExamScoreDto) {}

export class CreateLearningRecordDto {
  @IsDateString() recordDate: string;
  @IsString() @IsNotEmpty() recordType: string;
  @IsString() @IsNotEmpty() content: string;
  @IsOptional() @IsString() followUpMethod?: string;
  @IsOptional() @IsString() nextStep?: string;
}

export class UpdateLearningRecordDto extends PartialType(CreateLearningRecordDto) {}

export class UpsertResultDto {
  @IsOptional() @IsNumber() @Min(0) cultureFinalScore?: number;
  @IsOptional() @IsNumber() @Min(0) professionalFinalScore?: number;
  @IsOptional() @IsString() admissionStatus?: string;
  @IsOptional() @IsString() admittedCollege?: string;
  @IsOptional() @IsString() admittedMajor?: string;
}
