import { APIBase } from '@dvn/core/api/apiBase';
export class DevingenApi {
  constructor(endpoint, defaultHeaders = {}) {
    // region products
    this.createProduct = (body) => this.api.post(`products`, body);
    this.getProducts = () => this.api.get('products');
    this.getProduct = (id) => this.api.get(`products/${id}`);
    this.updateProduct = (id, body) => this.api.put(`products/${id}`, body);
    this.deleteProduct = (id) => this.api.delete(`products/${id}`);
    // endregion
    // region workspace
    this.createWorkspace = (name) => this.api.post(`workspaces`, { name });
    this.updateWorkspace = (id, body) => this.api.put(`workspaces/${id}`, body);
    this.deleteWorkspace = (id) => this.api.delete(`workspaces/${id}`);
    // endregion
    this.getWorkspaceOwnerships = () => this.api.get('workspace-ownerships');
    this.api = new APIBase(endpoint, defaultHeaders);
  }
}
