import { createContext, createRef } from 'react';
import { Avatar, EmailDisplay, PhoneDisplay, Link, Flex, Image, createUID } from '@pega/cosmos-react-core';
import { OpenGraphPreview } from '@pega/cosmos-react-social';
export const FeedDemoContext = createContext({
    posts: [],
    setPosts: () => { },
    showPostTypes: true,
    visibilityMode: 'public',
    simulateServerLatency: false,
    simulateServerError: false
});
export const FeedPostDemoContext = createContext({
    setReplyInputShown: () => { }
});
export const userMentions = [
    {
        id: 'turnc',
        primary: 'Cindy Turner',
        secondary: ['Lead Engineer'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(111) 111-1111'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='turnc@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Helen Bush'
            }
        ],
        visual: <Avatar size='m' name='Cindy Turner'/>
    },
    {
        id: 'deans',
        primary: 'Seth DeAngelo',
        secondary: ['Senior Software Engineer', 'Backend Developer'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(222) 222-2222'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='deans@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Helen Bush'
            }
        ],
        visual: <Avatar size='m' name='Seth DeAngelo'/>
    },
    {
        id: 'moorj',
        primary: 'Janet Moore',
        secondary: ['Backend Developer'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(333) 333-3333'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='moorj@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Helen Bush'
            }
        ],
        visual: <Avatar size='m' name='Janet Moore'/>
    },
    {
        id: 'thomd',
        primary: 'Dean Thomas',
        secondary: ['Designer'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(444) 444-4444'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='thomd@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Bob Hathoway'
            }
        ],
        visual: <Avatar size='m' name='Dean Thomas'/>
    },
    {
        id: 'hathb',
        primary: 'Bob Hathoway',
        secondary: ['Lead Designer', 'Product Owner'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(555) 555-5555'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='hathb@example.com'/>
            },
            {
                name: 'Reports to',
                value: ''
            }
        ],
        visual: <Avatar size='m' name='Bob Hathoway'/>
    },
    {
        id: 'amell',
        primary: 'Audrey Mell',
        secondary: ['Intern'],
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(666) 666-6666'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='amell@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Dean Thomas'
            }
        ],
        visual: <Avatar size='m' name='Audrey Mell'/>
    }
];
export const caseMentions = [
    {
        id: 'c-001',
        primary: 'Complete user sign up form',
        secondary: ['US-111111'],
        visual: <Avatar size='m' name='c-001' icon='case'/>,
        href: '#c-001'
    },
    {
        id: 'c-002',
        primary: 'Button missing on home page',
        secondary: ['BUG-222222'],
        visual: <Avatar size='m' name='c-002' icon='case'/>,
        href: '#c-002'
    },
    {
        id: 'c-003',
        primary: 'Set up transaction broker',
        secondary: ['US-333333'],
        visual: <Avatar size='m' name='c-03' icon='case'/>,
        href: '#c-003'
    },
    {
        id: 'c-004',
        primary: 'Check in with security team',
        secondary: ['TASK-444444'],
        visual: <Avatar size='m' name='c-004' icon='case'/>,
        href: '#c-004'
    },
    {
        id: 'c-005',
        primary: 'Error occurs upon submitting form',
        secondary: ['BUG-555555'],
        visual: <Avatar size='m' name='c-005' icon='case'/>,
        href: '#c-005'
    }
];
export const generatedLikes = [
    {
        primary: 'Cindy Turner',
        secondary: ['Lead Engineer'],
        visual: <Avatar size='m' name='Cindy Turner'/>,
        id: 'turnc'
    },
    {
        primary: 'Helen Bush',
        secondary: ['Product Manager', 'Product Owner'],
        visual: <Avatar size='m' name='Helen Bush'/>,
        id: 'bushh'
    },
    {
        primary: 'Randy Paul',
        secondary: ['Frontend Developer', 'Backend Developer'],
        visual: <Avatar size='m' name='Randy Paul'/>,
        id: 'paulr'
    },
    {
        primary: 'Janet Moore',
        secondary: ['Backend Developer'],
        visual: <Avatar size='m' name='Janet Moore'/>,
        id: 'moorj'
    },
    {
        primary: 'Kate Mirin',
        secondary: ['Quality Engineer'],
        visual: <Avatar size='m' name='Kate Mirin'/>,
        id: 'mirik'
    },
    {
        primary: 'Bob Hathoway',
        secondary: ['Lead Designer', 'Product Owner'],
        visual: <Avatar size='m' name='Bob Hathoway'/>,
        id: 'hathb'
    },
    {
        primary: 'Seth DeAngelo',
        secondary: ['Senior Software Engineer', 'Backend Developer'],
        visual: <Avatar size='m' name='Seth DeAngelo'/>,
        id: 'deans'
    },
    {
        primary: 'Dean Thomas',
        secondary: ['Designer'],
        visual: <Avatar size='m' name='Dean Thomas'/>,
        id: 'thomd'
    },
    {
        primary: 'Louie Santos',
        secondary: ['Marketing Specialist'],
        visual: <Avatar size='m' name='Louie Santos'/>,
        id: 'santl'
    },
    {
        primary: 'Margaret Foster',
        secondary: ['Architect', 'Designer'],
        visual: <Avatar size='m' name='Margaret Foster'/>,
        id: 'fostm'
    }
];
export const availableRecipients = [
    {
        primary: 'Cindy Turner',
        secondary: ['Lead Engineer'],
        visual: <Avatar size='m' name='Cindy Turner'/>,
        value: 'turnc',
        id: 'turnc'
    },
    {
        primary: 'Helen Bush',
        secondary: ['Product Manager', 'Product Owner'],
        visual: <Avatar size='m' name='Helen Bush'/>,
        value: 'bushh',
        id: 'bushh'
    },
    {
        primary: 'Randy Paul',
        secondary: ['Frontend Developer', 'Backend Developer'],
        visual: <Avatar size='m' name='Randy Paul'/>,
        value: 'paulr',
        id: 'paulr'
    },
    {
        primary: 'Janet Moore',
        secondary: ['Backend Developer'],
        visual: <Avatar size='m' name='Janet Moore'/>,
        value: 'moorj',
        id: 'moorj'
    },
    {
        primary: 'Kate Mirin',
        secondary: ['Quality Engineer'],
        visual: <Avatar size='m' name='Kate Mirin'/>,
        value: 'mirik',
        id: 'mirik'
    },
    {
        primary: 'Bob Hathoway',
        secondary: ['Lead Designer', 'Product Owner'],
        visual: <Avatar size='m' name='Bob Hathoway'/>,
        value: 'hathb',
        id: 'hathb'
    },
    {
        primary: 'Seth DeAngelo',
        secondary: ['Senior Software Engineer', 'Backend Developer'],
        visual: <Avatar size='m' name='Seth DeAngelo'/>,
        value: 'deans',
        id: 'deans'
    },
    {
        primary: 'Dean Thomas',
        secondary: ['Designer'],
        visual: <Avatar size='m' name='Dean Thomas'/>,
        value: 'thomd',
        id: 'thomd'
    },
    {
        primary: 'Louie Santos',
        secondary: ['Marketing Specialist'],
        visual: <Avatar size='m' name='Louie Santos'/>,
        value: 'santl',
        id: 'santl'
    },
    {
        primary: 'Margaret Foster',
        secondary: ['Architect', 'Designer'],
        visual: <Avatar size='m' name='Margaret Foster'/>,
        value: 'fostm',
        id: 'fostm'
    }
];
export const generateAvailableRecipients = (numOptions) => {
    const additionalRecipients = [];
    const iterations = (numOptions - availableRecipients.length) / 10;
    for (let i = 0; i < iterations; i += 1) {
        availableRecipients.forEach(item => {
            const newItem = {
                ...item,
                primary: `${item.primary} ${i + 1}`,
                value: `${item.value}${i + 1}`,
                id: `${item.id}${i + 1}`
            };
            additionalRecipients.push(newItem);
        });
    }
    return [...availableRecipients, ...additionalRecipients];
};
export const getActivityTypeOptions = (selectedId) => {
    return [
        {
            primary: 'Incident created',
            value: 'incidentCreated',
            selected: selectedId === 'incidentCreated',
            id: 'incidentCreated'
        },
        {
            primary: 'Incident resolved',
            value: 'incidentResolved',
            selected: selectedId === 'incidentResolved',
            id: 'incidentResolved'
        },
        {
            primary: 'Incident escalated',
            value: 'incidentEscalated',
            selected: selectedId === 'incidentEscalated',
            id: 'incidentEscalated'
        },
        {
            primary: 'Team meeting',
            value: 'teamMeeting',
            selected: selectedId === 'teamMeeting',
            id: 'teamMeeting'
        },
        {
            primary: 'Sprint review',
            value: 'sprintReview',
            selected: selectedId === 'sprintReview',
            id: 'sprintReview'
        },
        {
            primary: 'Sprint retrospective',
            value: 'sprintRetro',
            selected: selectedId === 'sprintRetro',
            id: 'sprintRetro'
        },
        {
            primary: 'Design review',
            value: 'designReview',
            selected: selectedId === 'designReview',
            id: 'designReview'
        }
    ];
};
const openGraphData = {
    title: 'Upcoming Events | Pega',
    image: 'https://www.pega.com/sites/default/files/default-og-800x400.png',
    description: "From in-person events to online gatherings, see how we're bringing enterprise transformation to life.",
    image_alt: 'Pega Events',
    href: 'https://www.pega.com/events'
};
const containerRef = createRef();
export const initialFeedPosts = [
    {
        id: createUID(),
        fullname: 'Feed Bot',
        icon: 'robot-solid',
        username: 'feed_bot',
        content: 'How is everyone doing with their reports?',
        postType: { id: 'private', label: 'Private post', icon: 'users-solid' },
        visibility: 'private',
        replies: [],
        likes: generatedLikes,
        likeCount: generatedLikes.length
    },
    {
        id: createUID(),
        fullname: 'Feed Bot',
        icon: 'robot-solid',
        username: 'feed_bot',
        content: (<Flex ref={containerRef} container={{ direction: 'column' }}>
        <span>
          Check out this awesome event!&nbsp;
          <Link href='https://www.pega.com/events'>https://www.pega.com/events</Link>
        </span>

        <Flex container={{ pad: [0.5, 0, 0, 0] }}>
          <OpenGraphPreview data={openGraphData} containerRef={containerRef}/>
        </Flex>
      </Flex>),
        postType: { id: 'private', label: 'Private post', icon: 'users-solid' },
        visibility: 'private',
        replies: []
    },
    {
        id: createUID(),
        fullname: 'Feed Bot',
        icon: 'robot-solid',
        username: 'feed_bot',
        content: (<Link href='https://www.pega.com/products/sales-automation'>
        <Flex container={{ direction: 'column' }}>
          Sales Automation makes business happen.
          <Image src='https://cf-images.us-east-1.prod.boltdns.net/v1/static/1900410236/893966f4-f7e1-41f0-9cc2-e3064273d3aa/72837f91-61a1-455b-a7e3-126972b61ddd/1280x720/match/image.jpg' alt='Pega Sales Automation'/>
        </Flex>
      </Link>),
        postType: { id: 'private', label: 'Private post', icon: 'users-solid' },
        visibility: 'private',
        replies: []
    }
];
export const feedUserGlimpseDetails = [
    {
        id: 'demoUser',
        username: 'demo_user',
        heading: {
            primary: 'Demo User',
            secondary: 'Mock data for the user of this demo',
            visual: <Avatar size='m' name='Demo User'/>
        },
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(111) 111-1111'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='demo.user@example.com'/>
            }
        ]
    },
    {
        id: 'feedBot',
        username: 'feed_bot',
        heading: {
            primary: 'Feed Bot',
            secondary: 'A bot that leaves messages for this demo',
            visual: <Avatar size='m' name='Feed Bot' icon='robot-solid'/>
        },
        fields: [
            {
                name: 'Project',
                value: 'Cosmos Demo'
            },
            {
                name: 'Phone number',
                value: <PhoneDisplay value='(010) 101-0101'/>
            },
            {
                name: 'Email',
                value: <EmailDisplay value='feed.bot@example.com'/>
            },
            {
                name: 'Reports to',
                value: 'Demo User'
            }
        ]
    }
];
export const uploadAttachment = (id, file, onProgress) => {
    let progress = 0;
    const interval = setInterval(() => {
        progress += 5;
        onProgress(id, progress);
    }, 100);
    setTimeout(() => {
        const currentAttachments = JSON.parse(window.localStorage.getItem('attachments') ?? '{}');
        window.localStorage.setItem('attachments', JSON.stringify({ ...currentAttachments, [id]: window.URL.createObjectURL(file) }));
        clearInterval(interval);
        return id;
    }, 4000);
};
export const getAttachment = async (id) => {
    return new Promise(res => {
        const currentAttachments = JSON.parse(window.localStorage.getItem('attachments') ?? '{}');
        setTimeout(() => {
            res(currentAttachments[id]);
        }, 2000);
    });
};
//# sourceMappingURL=Feed.mocks.jsx.map