import { cartItemsMock } from './cartItems';

const defaultCartMock = {
    id: '60ae9302f53d703ba2d57580',
    status: 'ACTIVE',
    buyerType: 'CUSTOMER',
    currency: 'USD',
    associations: []
};

export const cartMock = {
    ...defaultCartMock,
    items: cartItemsMock,
    pricingTotal: {
        amountDueAfterTax: '84.7275000000',
        amountDueBeforeTax: '79.0000000000',
        taxSummary: [
            {
                description: 'Flat Tax',
                taxAmount: '5.7275000000'
            }
        ],
        recurringTotals: [
            {
                billingCycle: {
                    period: 'MONTHLY',
                    dayOfMonth: 26
                },
                totalSalePrice: '79.0000000000',
                totalSalePriceTaxIncluded: null
            }
        ],
        totalTaxAmount: '5.7275000000'
    },
    itemsCount: cartItemsMock.length
};

export const cartEmptyMock = {
    ...defaultCartMock,
    items: [],
    pricingTotal: {},
    itemsCount: 0
};

export const editionProps = cartMock.items[0].itemDetails;

export const editionPropsWithoutIconUrl = {
    ...editionProps,
    branding: {
        ...editionProps.branding,
        iconUrl: null
    }
};

export const fetchCartMock = () => (
    new Promise(resolve => {
        setTimeout(() => {
            resolve({ ...cartMock });
        }, 1000);
    })
);

export const fetchEmptyCartMock = () => (
    new Promise(resolve => {
        setTimeout(() => {
            resolve({ ...cartEmptyMock });
        }, 1000);
    })
);
