#!perl
use Cassandane::Tiny;

sub test_calendarevent_get_participants
    :min_version_3_4
    ($self)
{
    my ($id, $ical) = $self->icalfile('participants');

    my $event = $self->putandget_vevent($id, $ical);

    my $wantParticipants = hashbag(
        ignore() => {
            '@type' => 'Participant',
            name => 'Monty Burns',
            roles => { 'required' => JSON::true, 'owner' => JSON::true },
            participationStatus => 'accepted',
            calendarAddress => 'mailto:smithers@example.com',
        },
        ignore() => {
            '@type' => 'Participant',
            name => 'Homer Simpson',
            participationStatus => 'accepted',
            roles => { 'optional' => JSON::true },
            calendarAddress => 'mailto:homer@example.com',
        },
        'carl' => {
            '@type' => 'Participant',
            name => 'Carl Carlson',
            participationStatus => 'tentative',
            scheduleSequence => 3,
            scheduleUpdated => '2017-01-02T03:04:05Z',
            delegatedFrom => hashbag('mailto:lenny@example.com' => JSON::true),
            calendarAddress => 'mailto:carl@example.com',
        },
        ignore() => {
            '@type' => 'Participant',
            name => 'Lenny Leonard',
            participationStatus => 'delegated',
            delegatedTo => hashbag('mailto:carl@example.com' => JSON::true),
            calendarAddress => 'mailto:lenny@example.com',
        },
        ignore() => {
            '@type' => 'Participant',
            name => 'Larry Burns',
            participationStatus => 'declined',
            roles => { 'required' => JSON::true },
            memberOf => hashbag('mailto:projectA@example.com' => JSON::true),
            scheduleUpdated => '2015-09-29T14:44:23Z',
            calendarAddress => 'mailto:larry@example.com',
        },
    );
    $self->assert_cmp_deeply($wantParticipants, $event->{participants});
}
