import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsInt, IsNotEmpty, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';

export class CreateTemplateFormSectionDto {
  @ApiProperty({ description: 'Program template ID', example: 1 })
  @IsInt()
  @IsNotEmpty()
  programTemplateId: number;

  @ApiProperty({ description: 'Master form section ID (if cloned from master)', required: false, type: Number })
  @IsOptional()
  @IsInt()
  masterFormSectionId?: number;

  @ApiProperty({ description: 'Unique section key identifier', example: 'FS_PERSONALINFO' })
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  sectionKey: string;

  @ApiProperty({ description: 'Section name', example: 'Personal Information' })
  @IsString()
  @IsNotEmpty()
  @MaxLength(255)
  name: string;

  @ApiProperty({ description: 'Section description', required: false, example: 'Section for personal details' })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiProperty({ description: 'Parent section ID for nested sections (template level)', required: false, type: Number })
  @IsOptional()
  @IsInt()
  parentSectionId?: number;

  @ApiProperty({ description: 'Conditional display configuration', required: false, type: Object })
  @IsOptional()
  @IsObject()
  conditionalConfig?: Record<string, any>;

  @ApiProperty({ description: 'Display order within the template', example: 1 })
  @IsInt()
  @IsNotEmpty()
  displayOrder: number;

  @ApiProperty({ description: 'User ID who created this section', required: false })
  @IsOptional()
  @IsInt()
  createdBy?: number;
}
