import { UmbRepositoryBase } from '../../../../core/repository/index.js';
import { DocumentService } from '../../../../core/backend-api/index.js';
import { tryExecute } from '../../../../core/resources/index.js';
export class UmbDocumentSegmentRepository extends UmbRepositoryBase {
    /**
     * Get available segment options for a document by its ID.
     * @param {string} unique The unique identifier of the document.
     * @param {UmbDocumentSegmentFilterModel} filter The filter options to apply.
     * @returns A promise that resolves with the available segment options.
     */
    async getDocumentByIdSegmentOptions(unique, filter) {
        const { data, error } = await tryExecute(this, 
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        DocumentService.getDocumentByIdAvailableSegmentOptions({ path: { id: unique }, query: filter }));
        if (data) {
            const items = data.items.map((item) => {
                const model = {
                    alias: item.alias,
                    name: item.name,
                    // eslint-disable-next-line @typescript-eslint/no-deprecated
                    cultures: item.cultures,
                };
                return model;
            });
            return { data: { items, total: data.total } };
        }
        return { error };
    }
}
