// Auto-generated by AutoCRUD Web Generator
import { client } from '../../lib/client';
import type { GameEvent } from '../types';
import type { ResourceMeta, RevisionInfo, FullResource, RevisionListResponse, RevisionListParams, SearchParams } from '../../types/api';

const BASE = '/game-event';

export const gameEventApi = {
  create: (data: GameEvent) =>
    client.post<RevisionInfo>(BASE, data),

  list: (params?: SearchParams & { returns?: string }) =>
    client.get<FullResource<GameEvent>[]>(BASE, { params }),

  count: (params?: SearchParams) =>
    client.get<number>(`${BASE}/count`, { params }),

  get: (id: string, params?: { revision_id?: string; partial?: string[]; returns?: string }) =>
    client.get<FullResource<GameEvent>>(`${BASE}/${id}`, { params }),

  update: (id: string, data: GameEvent, params?: { change_status?: string; mode?: string }) =>
    client.put<RevisionInfo>(`${BASE}/${id}`, data, { params }),

  delete: (id: string) =>
    client.delete<ResourceMeta>(`${BASE}/${id}`),

  restore: (id: string) =>
    client.post<ResourceMeta>(`${BASE}/${id}/restore`),

  revisionList: (id: string, params?: RevisionListParams) =>
    client.get<RevisionListResponse>(`${BASE}/${id}/revision-list`, { params }),

  switchRevision: (id: string, revisionId: string) =>
    client.post<ResourceMeta>(`${BASE}/${id}/switch/${revisionId}`),

  rerun: (id: string) =>
    client.post<RevisionInfo>(`${BASE}/${id}/rerun`),
};
