import type { FrontendPayloadRequestData } from "../payload/payloadTypes"
import type { FastifyInstance } from "fastify"

export interface CrudHandlers<T> {
  create: (
    fastify: FastifyInstance,
    requestParams: FrontendPayloadRequestData,
    data: Partial<T>,
    userId: string,
    broadcast?: boolean,
  ) => Promise<any>
  read: (
    fastify: FastifyInstance,
    requestParams: FrontendPayloadRequestData,
    id: string,
  ) => Promise<any>
  update: (
    fastify: FastifyInstance,
    requestParams: FrontendPayloadRequestData,
    id: string,
    data: Partial<T>,
    userId: string,
    broadcast?: boolean,
  ) => Promise<any>
  delete: (
    fastify: FastifyInstance,
    requestParams: FrontendPayloadRequestData,
    id: string,
    userId: string,
    broadcast?: boolean,
  ) => Promise<any>
}
