export const suggestionResultMock = val => [
    {
        editionPricingUuid: '6a64b617-a506-4f47-a38b-fd4c78e8fd07',
        name: `${val}.us`,
        currency: 'USD',
        contractDuration: 1,
        priceRecurringPerYear: 34.99,
        privacyEnabled: false,
        formattedPricePerYear: '$34.99',
        available: true
    },
    {
        editionPricingUuid: '6a64b617-a506-4f47-a38b-fd4c78e8fd07',
        name: `${val}.com`,
        currency: 'USD',
        contractDuration: 1,
        priceRecurringPerYear: 34.99,
        privacyEnabled: false,
        formattedPricePerYear: '$34.99',
        available: false
    },
    {
        editionPricingUuid: '0fce3d60-2a5f-44da-80d6-fb6468a810fe',
        name: `${val}.me`,
        currency: 'USD',
        contractDuration: 1,
        priceRecurringPerYear: 33.98,
        privacyEnabled: false,
        formattedPricePerYear: '$33.98',
        available: true
    },
    {
        editionPricingUuid: '2bc5da1d-8346-4ce9-9a75-258a53460ed6',
        name: `${val}.com.mx`,
        currency: 'USD',
        contractDuration: 3,
        priceRecurringPerYear: 39.98,
        privacyEnabled: false,
        formattedPricePerYear: '$39.98',
        available: true
    },
    {
        editionPricingUuid: 'ee12da47-4be3-40a2-97f2-2739c0d90791',
        name: `${val}.co`,
        currency: 'USD',
        contractDuration: 1,
        priceRecurringPerYear: 16.58,
        privacyEnabled: false,
        formattedPricePerYear: '$16.58',
        available: true
    }
];


// mock suggestion ajax call
export const fetchSuggestionsMock = params => (
    new Promise(resolve => {
        setTimeout(() => {
            resolve(suggestionResultMock(params.q));
        }, 1000);
    })
);

export const fetchEmptySuggestionsMock = () => (
    new Promise(resolve => {
        setTimeout(() => {
            resolve([]);
        }, 1000);
    })
);

export const failedFetchSuggestionsMock = () => (
    new Promise((resolve, reject) => {
        setTimeout(() => {
            reject(new Error('Network error'));
        }, 1000);
    })
);
