/**
 * Terminal Session DTOs
 *
 * Data Transfer Objects for terminal session persistence endpoints.
 * Validated using class-validator decorators.
 */

import { IsString, IsOptional, MaxLength, IsEnum, IsUUID } from "class-validator";
import { TerminalSessionStatus } from "@prisma/client";

/**
 * DTO for creating a new terminal session record.
 */
export class CreateTerminalSessionDto {
  @IsString()
  @IsUUID()
  workspaceId!: string;

  @IsOptional()
  @IsString()
  @MaxLength(128)
  name?: string;
}

/**
 * DTO for querying terminal sessions by workspace.
 */
export class FindTerminalSessionsByWorkspaceDto {
  @IsString()
  @IsUUID()
  workspaceId!: string;
}

/**
 * Response shape for a terminal session.
 */
export class TerminalSessionResponseDto {
  id!: string;
  workspaceId!: string;
  name!: string;
  status!: TerminalSessionStatus;
  createdAt!: Date;
  closedAt!: Date | null;
}

/**
 * DTO for filtering terminal sessions by status.
 */
export class TerminalSessionStatusFilterDto {
  @IsOptional()
  @IsEnum(TerminalSessionStatus)
  status?: TerminalSessionStatus;
}
