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

export class ContractSignatureDto {
  @ApiProperty({ enum: ['CUSTOMER', 'STAFF'] })
  role!: string;

  @ApiProperty()
  signerDisplayName!: string;

  @ApiProperty()
  signedAt!: string;

  @ApiPropertyOptional()
  signatureImageUrl?: string | null;
}

export class SavedSignatureViewDto {
  @ApiProperty()
  signerDisplayName!: string;

  @ApiPropertyOptional()
  signatureImageUrl?: string | null;
}

export class ContractViewDto {
  @ApiProperty()
  bookingId!: string;

  @ApiProperty()
  reference!: string;

  @ApiProperty()
  status!: string;

  @ApiProperty()
  templateKey!: string;

  @ApiProperty()
  title!: string;

  @ApiProperty({ description: 'Full HTML document for in-browser display' })
  html!: string;

  @ApiProperty()
  canSignCustomer!: boolean;

  @ApiProperty()
  canSignStaff!: boolean;

  @ApiProperty()
  hasContractDocument!: boolean;

  @ApiProperty({ type: [ContractSignatureDto] })
  signatures!: ContractSignatureDto[];

  @ApiPropertyOptional({ type: SavedSignatureViewDto })
  savedSignature?: SavedSignatureViewDto;

  @ApiPropertyOptional()
  pricingSchedule?: Record<string, unknown>;
}
