import { ApiPropertyOptional } from '@nestjs/swagger';
import {
  IsNumber,
  IsOptional,
  IsString,
  IsNotEmpty,
  MinLength,
  MaxLength,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

/**
 * Create Release Note Data Transfer Object (DTO)
 *
 * This DTO is used for creating new release note entries in the application.
 * Release notes document changes across different categories: development,
 * bug fixes, and general changes for a specific version or release.
 *
 * This DTO appears incomplete as it's missing critical fields typically found
 * in release notes such as version number, title, release date, etc.
 *
 * @example
 * // Creating a basic release note:
 * {
 *   "development_note": "Added new commission calculation module",
 *   "bugfix_note": "Fixed issue with commission percentage calculation",
 *   "change_note": "Updated user interface for commission reports",
 *   "status": 1
 * }
 *
 * @example
 * // Creating with only some fields:
 * {
 *   "bugfix_note": "Resolved database connection timeout issue",
 *   "status": 1
 * }
 *
 * @note This DTO seems incomplete. Release notes typically require:
 * - Version number (e.g., "1.2.3")
 * - Title or heading
 * - Release date
 * - At least one note field should be required
 */
export class CreateReleaseNoteDto {
  /**
   * Notes about new development work or features added in this release.
   *
   * @type {string}
   * @optional
   * @example "Added new commission calculation module with advanced analytics"
   * @example "Implemented real-time notification system for commission updates"
   *
   * @isString - Validation: Must be a string if provided
   *   Error message: "development_note must be a string"
   *
   * @isOptional - Validation: Field is not required
   *
   * @apiPropertyOptional - Swagger documentation for optional field
   *
   * @note Consider making at least one note field required or adding
   * validation that at least one of development_note, bugfix_note, or change_note
   * must be provided.
   */
  @ApiPropertyOptional({
    description: 'Notes about new development work or features',
    example: 'Added new commission calculation module',
    type: String,
  })
  @IsOptional()
  @IsString({ message: 'Development note must be a string if provided' })
  development_note?: string;

  /**
   * Notes about bug fixes or issues resolved in this release.
   *
   * @type {string}
   * @optional
   * @example "Fixed commission percentage calculation for edge cases"
   * @example "Resolved database connection timeout during peak hours"
   *
   * @isString - Validation: Must be a string if provided
   *   Error message: "bugfix_note must be a string"
   *
   * @isOptional - Validation: Field is not required
   */
  @ApiPropertyOptional({
    description: 'Notes about bug fixes or issues resolved',
    example: 'Fixed issue with commission percentage calculation',
    type: String,
  })
  @IsOptional()
  @IsString({ message: 'Bug fix note must be a string if provided' })
  bugfix_note?: string;

  /**
   * Notes about general changes, improvements, or updates in this release.
   *
   * @type {string}
   * @optional
   * @example "Updated user interface for better commission report visibility"
   * @example "Improved database query performance for commission searches"
   *
   * @isString - Validation: Must be a string if provided
   *   Error message: "change_note must be a string"
   *
   * @isOptional - Validation: Field is not required
   */
  @ApiPropertyOptional({
    description: 'Notes about general changes or improvements',
    example: 'Updated user interface for commission reports',
    type: String,
  })
  @IsOptional()
  @IsString({ message: 'Change note must be a string if provided' })
  change_note?: string;

  /**
   * Status of the release note (e.g., draft, published, archived).
   *
   * @type {number}
   * @optional
   * @example 1 (draft)
   * @example 2 (published)
   * @example 3 (archived)
   *
   * @isNumber - Validation: Must be a number if provided
   *   Error message: "status must be a number"
   *
   * @isOptional - Validation: Field is not required
   *
   * @note Consider using an enum for status values for better type safety:
   *   status?: ReleaseNoteStatus;
   *   enum ReleaseNoteStatus { DRAFT = 1, PUBLISHED = 2, ARCHIVED = 3 }
   */
  @ApiPropertyOptional({
    description:
      'Status of the release note (e.g., 1=draft, 2=published, 3=archived)',
    example: 1,
    type: Number,
  })
  @IsOptional()
  @IsNumber({}, { message: 'Status must be a number if provided' })
  status?: number;
}
