import { TypedResponse } from '../../http';
import { BimChange, BimChangeLayer, BimChangeLayerData, BlobData } from '../bim-api-client';

/** Provides methods to call the layer API endpoints in the backend */
export interface LayerApiClient {
    /**
     * Adds a layer
     * @param attachTo a change to attach the layer to. id is required while name is optional. If name is not specified
     * then it is calculated from the data format.
     * @param data
     */
    add: (
        attachTo: Pick<BimChange, 'id' | 'apiUrl'> & Partial<Pick<BimChange, 'name'>>,
        data: BimChangeLayerData
    ) => Promise<TypedResponse<BimChangeLayer>>;

    update: (
        layer: Pick<BimChangeLayer, 'etag' | 'id' | 'metadata' | 'name' | 'apiUrl'>,
        options?: {
            data?: BlobData;
            overwrite?: boolean;
        }
    ) => Promise<TypedResponse<BimChangeLayer>>;
}
