import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

const PROCESS_STATUS_VALUES = [
  'NOT_STARTED',
  'IN_PROGRESS',
  'COMPLETED',
] as const;

export type AssemblyMonitoringUnitProcessStatus =
  (typeof PROCESS_STATUS_VALUES)[number];

export class AssemblyMonitoringUnitProcessStepResponseDto {
  @ApiProperty({ type: String })
  name!: string;

  @ApiProperty({ enum: PROCESS_STATUS_VALUES })
  status!: AssemblyMonitoringUnitProcessStatus;

  @ApiProperty({ type: String, nullable: true })
  completedAt!: string | null;

  @ApiProperty({ type: Number, nullable: true })
  durationMinutes!: number | null;

  @ApiPropertyOptional({ type: String, nullable: true })
  durationText?: string | null;

  @ApiPropertyOptional({ type: String, nullable: true })
  rawWork?: string | null;
}

export class AssemblyMonitoringUnitDetailResponseDto {
  @ApiProperty({ type: Number })
  prodPlanSeq!: number;

  @ApiProperty({ type: String })
  prodPlanNo!: string;

  @ApiProperty({ type: Number })
  modelSeq!: number;

  @ApiProperty({ type: String })
  serialNo!: string;

  @ApiProperty({ type: String })
  modelName!: string;

  @ApiProperty({ type: [AssemblyMonitoringUnitProcessStepResponseDto] })
  steps!: AssemblyMonitoringUnitProcessStepResponseDto[];
}
