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

export const getAllTypes = async () => {
    return api.get<GeometryType[]>('/geometry-types');
};

export const createType = async (data: { name: string; efficiencyLoss: number }) => {
    return api.post<GeometryType>('/geometry-types', data);
};

export const updateType = async (id: string, data: { name: string; efficiencyLoss: number }) => {
    return api.put<GeometryType>(`/geometry-types/${id}`, data);
};

export const deleteType = async (id: string) => {
    return api.delete(`/geometry-types/${id}`);
};

export const restoreDefaults = async () => {
    return api.post<GeometryType[]>('/geometry-types/restore', {});
};
