/**
 * UpdateStatusDto
 * ----------------
 * DTO used to perform bulk status updates (activate / deactivate)
 * on Menu Groups.
 *
 * Purpose:
 * - Enables bulk activation or deactivation
 * - Keeps status changes explicit and intention-revealing
 * - Prevents misuse of generic update endpoints
 *
 * Used in:
 * - MenuGroupsController.updateStatus()
 *
 * Example Payload:
 * {
 *   "action": "activate",
 *   "ids": [1, 3, 5]
 * }
 */
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, IsNotEmpty, IsArray } from 'class-validator';
import { StatusAction } from 'src/utils/enums/enum';

export class UpdateStatusDto {
  /**
   * Status Action
   * -------------
   * Defines the operation to be performed on the given records.
   *
   * Allowed Values (StatusAction enum):
   * - activate   → Marks records as active
   * - deactivate → Marks records as inactive
   *
   * Validation:
   * - Required field
   * - Must match one of the StatusAction enum values
   *
   * Error Handling:
   * - Custom error message returned if invalid value is provided
   *
   * Swagger:
   * - Enum dropdown shown in API documentation
   */
  @IsNotEmpty()
  @IsEnum(StatusAction, {
    message: 'action must be either activate or deactivate',
  })
  @ApiProperty({ enum: StatusAction })
  action: StatusAction;

  /**
   * Target Record IDs
   * -----------------
   * List of Menu Group IDs whose status should be updated.
   *
   * Use Case:
   * - Bulk enable / disable operations from admin UI
   *
   * Validation:
   * - Required field
   * - Must be an array
   *
   * Design Note:
   * - Numeric IDs assumed to be validated further at service/repository level
   * - Empty array should ideally be guarded against in service logic
   *
   * Swagger:
   * - Displays as array of numbers
   */
  @IsNotEmpty()
  @IsArray()
  @ApiProperty({ type: [Number] })
  ids: number[];
}
