import { ApiProperty } from '@nestjs/swagger';
import { RequestStatus } from '../enums/request-status.enum';
import { RequestType } from '../enums/request-type.enum';

export class RequestResponseDto {
  @ApiProperty({
    description: 'Request ID (UUID)',
    example: '550e8400-e29b-41d4-a716-446655440000',
  })
  id: string;

  @ApiProperty({
    description: 'Unique request number',
    example: 'RL-2024-000001',
  })
  requestNumber: string;

  @ApiProperty({
    description: 'Applicant ID',
    example: '550e8400-e29b-41d4-a716-446655440000',
  })
  applicantId: string;

  @ApiProperty({
    description: 'Type of license request',
    enum: RequestType,
  })
  requestType: RequestType;

  @ApiProperty({
    description: 'Current status of the request',
    enum: RequestStatus,
  })
  status: RequestStatus;

  @ApiProperty({
    description: 'Current workflow stage ID',
    nullable: true,
  })
  currentStageId: string | null;

  @ApiProperty({
    description: 'Workflow ID (UUID)',
    example: '550e8400-e29b-41d4-a716-446655440000',
    required: false,
  })
  workflowId?: string;

  @ApiProperty({
    description: 'Workflow code',
    example: 'FIRE_SAFETY_CERT',
    required: false,
  })
  workflowCode?: string;

  @ApiProperty({
    description: 'Current step index in workflow',
    example: 0,
    required: false,
  })
  currentStepIndex?: number;

  @ApiProperty({
    description: 'Assigned department code',
    example: 'FIRE_DEPT',
    required: false,
  })
  assignedDepartment?: string;

  @ApiProperty({
    description: 'Request metadata',
    type: Object,
  })
  metadata: Record<string, any>;

  @ApiProperty({
    description: 'Form data (alias for metadata)',
    type: Object,
    required: false,
  })
  formData?: Record<string, any>;

  @ApiProperty({
    description: 'Applicant name',
    example: 'John Doe',
    required: false,
  })
  applicantName?: string;

  @ApiProperty({
    description: 'Business name',
    example: 'ABC Restaurant',
    required: false,
  })
  businessName?: string;

  @ApiProperty({
    description: 'Blockchain transaction hash',
    nullable: true,
  })
  blockchainTxHash: string | null;

  @ApiProperty({
    description: 'Token ID on blockchain',
    nullable: true,
  })
  tokenId: string | null;

  @ApiProperty({
    description: 'Request creation timestamp',
    example: '2024-01-15T10:30:00Z',
  })
  createdAt: Date;

  @ApiProperty({
    description: 'Request last update timestamp',
    example: '2024-01-16T14:45:00Z',
  })
  updatedAt: Date;

  @ApiProperty({
    description: 'Request submission timestamp',
    nullable: true,
    example: '2024-01-15T11:00:00Z',
  })
  submittedAt: Date | null;

  @ApiProperty({
    description: 'Request approval timestamp',
    nullable: true,
    example: '2024-01-20T09:00:00Z',
  })
  approvedAt: Date | null;

  // Allow additional dynamic properties from metadata
  [key: string]: any;
}
