/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CanvasState } from '../models/CanvasState';
import type { BaseResponse } from '../models/BaseResponse';
import { request as __request } from '../core/request';
import { OpenAPI } from '../core/OpenAPI';

export class CanvasService {
    /**
     * Get canvas state by ID
     * Returns empty default state if canvas not found.
     * @param id Canvas ID
     * @param projectId Project ID
     * @returns BaseResponse Canvas state retrieved successfully
     * @throws ApiError
     */
    public static async getCanvasState(
        id: string,
        projectId?: string,
    ): Promise<BaseResponse> {
        const result = await __request(OpenAPI, {
            method: 'GET',
            url: `/api/v1/canvas`,
            query: {
                'id': id,
                'projectId': projectId,
            },
            errors: {
                500: `Internal server error`,
            },
        });
        return result as any;
    }

    /**
     * Save canvas state
     * @param requestBody Canvas state to save
     * @returns BaseResponse Canvas state saved successfully
     * @throws ApiError
     */
    public static async saveCanvasState(
        requestBody: CanvasState,
    ): Promise<BaseResponse> {
        const result = await __request(OpenAPI, {
            method: 'POST',
            url: `/api/v1/canvas`,
            body: requestBody,
            errors: {
                500: `Internal server error`,
            },
        });
        return result as any;
    }
}
