import { WorkspaceScopedResource, extractData } from './base.js';
/**
 * Surfaces — short-lived form/intake experiences the platform delivers via
 * SMS / email / web. The full lifecycle is exposed: create, deliver, monitor
 * progress, gate for review, approve / reject / reshape, and archive.
 *
 * @beta New in this release; surface may evolve as the operator review flow
 * stabilizes.
 */
export class SurfacesResource extends WorkspaceScopedResource {
    /** List surfaces in the workspace */
    async list(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/surfaces', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    listAutoPaging(params) {
        return this.iteratePaginatedList((pageParams) => this.list(pageParams), params);
    }
    /** Surfaces awaiting review (pending approval / rejection) */
    async listForReview(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/surfaces/review', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    /** Create a surface (form definition + delivery config) */
    async create(body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/surfaces', {
            params: { path: { workspace_id: this.workspaceId } },
            body,
        }));
    }
    /** Get a single surface */
    async get(surfaceId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/surfaces/{surface_id}', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
        }));
    }
    /** Update surface metadata or fields */
    async update(surfaceId, body) {
        return extractData(await this.client.PATCH('/v1/{workspace_id}/surfaces/{surface_id}', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
            body,
        }));
    }
    /** Archive (soft-delete) a surface */
    async archive(surfaceId) {
        return extractData(await this.client.DELETE('/v1/{workspace_id}/surfaces/{surface_id}', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
        }));
    }
    /** Deliver the surface to the recipient (SMS/email/etc.) */
    async deliver(surfaceId, body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/surfaces/{surface_id}/deliver', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
            body,
        }));
    }
    /** Get fill / completion progress for a surface */
    async getProgress(surfaceId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/surfaces/{surface_id}/progress', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
        }));
    }
    /** Approve a pending-review surface */
    async approve(surfaceId) {
        return extractData(await this.client.POST('/v1/{workspace_id}/surfaces/{surface_id}/approve', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
        }));
    }
    /** Reject a pending-review surface */
    async reject(surfaceId, body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/surfaces/{surface_id}/reject', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
            body,
        }));
    }
    /** Reshape — clone the surface with refined fields (review redirect) */
    async reshape(surfaceId) {
        return extractData(await this.client.POST('/v1/{workspace_id}/surfaces/{surface_id}/reshape', {
            params: { path: { workspace_id: this.workspaceId, surface_id: surfaceId } },
        }));
    }
}
//# sourceMappingURL=surfaces.js.map