import api from './api';
import { type Operation } from '../types/Operation';

export const operationService = {
  getAll: async (): Promise<Operation[]> => {
    const response = await api.get<Operation[]>('/operations');
    return response.data;
  },

  create: async (name: string): Promise<Operation> => {
    const response = await api.post<Operation>('/operations', { name });
    return response.data;
  },

  delete: async (id: number): Promise<void> => {
    await api.delete(`/operations/${id}`);
  }
};
