import {
  IsArray,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
} from "class-validator";

export class FunctionDto {
  @IsString()
  @IsNotEmpty()
  _id!: string;

  @IsString()
  @IsNotEmpty()
  name!: string;

  @IsString()
  @IsNotEmpty()
  path!: string;

  @IsArray()
  methods!: string[];

  @IsString()
  @IsOptional()
  code?: string;

  @IsNumber()
  invocations!: number;

  @IsNumber()
  errors!: number;

  @IsArray()
  logs!: string[];

  lastInvocation?: Date;
}
