import type {
    FilterOptions,
    ReviewQueueSearchItem,
} from 'src/data/queries/reviewQueueSearch/types';

export const getReviewQueueSearchFilterOptions = (): FilterOptions => ({
    accountCountry: [{ id: 'US', name: 'USA' }],
    accountId: [
        { id: '16156:0', name: 'RB2 Test Label', extra: null },
        { id: '21645:0', name: 'Tipica Records S.R.L', extra: null },
        {
            name: 'Cosmos',
            id: '20325:10496',
            extra: {
                labelId: '20325:10496',
                labelName: 'Cosmos music AB',
            },
        },
    ],
    assignedToId: [{ id: '170', name: 'Label Services' }],
    assignedReviewerId: [{ id: '071', name: 'Services Label' }],
    bulkSessionId: [
        {
            id: 'abc-1',
            name: 'abc-1',
        },
    ],
    companyBrandUuid: [{ id: 'abc', name: 'PDE', extra: { code: 'abc' } }],
    genreId: [{ id: '1', name: 'Rock' }],
    movedById: [{ id: '2', name: 'Moved By' }],
    serviceTierUuid: [{ id: 'abc123', name: 'Tier 1' }],
    submissionType: [
        {
            id: 'New',
            name: 'New',
        },
    ],
    metadataLanguageCode: [
        { id: 'ENG', name: 'English' },
        { id: 'UKR', name: 'Ukrainian' },
    ],
    noticeCode: [
        {
            id: 'ARTWORK',
            name: 'ARTWORK',
        },
        {
            id: 'MISSING_AUDIO_FILE',
            name: 'MISSING_AUDIO_FILE',
        },
    ],
    queueName: [
        { id: 'initial', name: 'initial' },
        { id: 'under_investigation', name: 'under_investigation' },
    ],
    movedToTargetId: [
        { id: '1', name: 'Label Manager' },
        { id: '2', name: 'QC Support' },
    ],
});

export const generateMockedReviewQueueSearchItems = (amount: number) => {
    const objects = [];
    for (let i = 0; i < amount; i++)
        objects.push({
            __typename: 'ReviewQueueSearchResult',
            accountId: 'a',
            productId: 1 + i,
        } as Partial<ReviewQueueSearchItem>);

    return objects;
};

export const generateMockedReviewQueueSearch = () => ({
    items: [
        {
            accountId: '33088:0',
            accountName: 'BigHead - Manual Test Label',
            addedAt: '2021-12-08T20:29:33.000000Z',
            assignedToId: 170,
            assignedToName: 'Label Services',
            assignedReviewerId: 2181,
            assignedReviewerName: 'Reviewer 12321',
            escalationType: null,
            featuringArtist: 'Test FeaturingArtist',
            format: 'EP',
            imageLocation:
                'https://qa-images.theorchard.io/product/cover/6c2fabf43d725be5de6a1a27cfce4618.jpg',
            imprint: 'TestImprint',
            labelId: 33088,
            labelName: 'BigHead - Manual Test Label',
            preorderDate: '2021-11-21',
            primaryArtist: 'novrelease artist',
            productId: 3578395,
            productName: 'Nov30releasetest1',
            queueName: 'initial',
            submissionCount: 1,
            submissionType: 'New',
            reviewQueueId: 1446,
            saleStartDate: '2021-11-17',
            secondaryInternalContactName: 'Foo',
            specialInstructions: 'Special instructions',
            serviceTierName: 'Tier 1',
            serviceTierUuid: 'abc123',
            subaccountId: 0,
            subaccountName: 'Subaccount name',
            submissionDatetime: '2021-12-08T20:29:33.000000Z',
            upc: '196626006561',
            metadataLanguageName: 'English',
            movedToQueueByUserName: null,
            movedToTargetId: '1',
            movedToTargetName: 'test',
            movedToTargetEmail: 'foo@bar.com',
            notices: [
                {
                    code: 'ARTWORK',
                    level: 'errors',
                },
                {
                    code: 'MISSING_AUDIO_FILE',
                    level: 'errors',
                },
                {
                    code: 'MISSING_AUDIO_FILE',
                    level: 'errors',
                },
            ],
        },
    ],
    totalCount: 1,
    queueCounts: [{ queueName: 'initial', count: 1 }],
    filterOptions: getReviewQueueSearchFilterOptions(),
});
