import { Prisma } from '@prisma/client';
import { IsOptional, IsString } from 'class-validator';

export class CreateCanvasDto {
  @IsString()
  name: string;

  @IsOptional()
  items?: Prisma.InputJsonValue;

  @IsOptional()
  layout?: Prisma.InputJsonValue;
}

export class UpdateCanvasDto {
  @IsOptional()
  @IsString()
  name?: string;

  @IsOptional()
  items?: Prisma.InputJsonValue;

  @IsOptional()
  layout?: Prisma.InputJsonValue;

  @IsOptional()
  @IsString()
  publishedPageCode?: string;
}

export class PublishCanvasDto {
  @IsString()
  slug: string;

  @IsString()
  pageName: string;

  @IsOptional()
  @IsString()
  parentPageCode?: string;
}

export class CreateSavedQueryDto {
  @IsString()
  sql: string;

  @IsString()
  description: string;
}
