-- Some sample data to prime the database...

-- FIXME: Only insert the rows if they are not there already.
INSERT INTO roles ( role_no, role_name ) VALUES( 1, 'Admin');
INSERT INTO roles ( role_no, role_name ) VALUES( 2, 'Group');
INSERT INTO roles ( role_no, role_name ) VALUES( 3, 'Public');
INSERT INTO roles ( role_no, role_name ) VALUES( 4, 'Resource');

INSERT INTO role_member (user_no, role_no) VALUES(1, 1);

INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers )
    VALUES( 1, 'Administers', 'A', privilege_to_bits('DAV::all') );

INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers )
    VALUES( 2, 'Can read/write to', 'RW', privilege_to_bits( ARRAY['DAV::read','DAV::write']) );

INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers )
    VALUES( 3, 'Can read from', 'R', privilege_to_bits( 'DAV::read') );

INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers )
    VALUES( 4, 'Can see free/busy time of', 'F', privilege_to_bits( 'caldav:read-free-busy') );

INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 1, 'Person' );
INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 2, 'Resource' );
INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 3, 'Group' );

INSERT INTO principal ( type_id, user_no, displayname, default_privileges )
    VALUES ( 1, 1, 'DAViCal Administrator', 0::BIT(24) );

