import WebFragments from 'bitbucket/internal/bbui/web-fragments/web-fragments';

class MockWebFragments extends WebFragments {
    getWebItems(location, context) {
        return [WebFragments.getExampleItem(location, context)];
    }

    getWebSections(location, context) {
        return [WebFragments.getExampleSection(location, context)];
    }

    getWebPanels(location, context) {
        return [WebFragments.getExamplePanel(location, context)];
    }

    getWebFragments(location, types, context) {
        return types.map(function(type) {
            switch (type) {
                case 'ITEM': return WebFragments.getExampleItem(location, context);
                case 'SECTION': return WebFragments.getExampleSection(location, context);
                case 'PANEL': return WebFragments.getExamplePanel(location, context);
            }
        });
    }
}

const mockWebFragments = new MockWebFragments();
export default mockWebFragments;
export const getWebItems = mockWebFragments.getWebItems;
export const getWebSections = mockWebFragments.getWebSections;
export const getWebPanels = mockWebFragments.getWebPanels;
export const getWebFragments = mockWebFragments.getWebFragments;