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 = (query = {}) => this.api.get('products', query);
    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');
    // region product-settings-kimlik
    this.createProductSettingsKimlik = (productId, databaseProductId, webhookAddress, headers) => this.api.post(`product-settings-kimlik`, { product: { _id: productId }, databaseProduct: { _id: databaseProductId }, webhookAddress, headers });
    this.findProductSettingsKimlik = (productId) => this.api.get(`product-settings-kimlik`, { productId });
    // endregion
    // region product-settings-taban
    this.createProductSettingsTaban = (productId) => this.api.post(`product-settings-taban`, { product: { _id: productId } });
    this.findProductSettingsTaban = (productId) => this.api.get(`product-settings-taban`, { productId });
    this.api = new APIBase(endpoint, defaultHeaders);
  }
}
