-- More users
insert into "user" ("username", "password_hash", "status", "picture", "bio")
values
    ('alice', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', 'https://example.com/alice.jpg', 'Loves coding and coffee.'),
    ('bob', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Away', 'https://example.com/bob.jpg', 'Gamer and tech enthusiast.'),
    ('charlie', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Busy', 'https://example.com/charlie.jpg', 'Database aficionado.'),
    ('diana', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', 'https://example.com/diana.jpg', 'Enjoys reading and hiking.');

-- More roles
insert into "role" ("name")
values
    ('moderator'),
    ('guest');

-- More channels
call add_channel('general', 'General discussion channel');
call add_channel('development', 'Channel for development topics');
call add_channel('random', 'Anything goes in here');

-- Role bindings for new users
insert into "role_binding" ("user_id", "role_id")
values
    ((select "id" from "user" where "username" = 'alice'), (select "id" from "role" where "name" = 'member')),
    ((select "id" from "user" where "username" = 'bob'), (select "id" from "role" where "name" = 'member')),
    ((select "id" from "user" where "username" = 'charlie'), (select "id" from "role" where "name" = 'moderator')),
    ((select "id" from "user" where "username" = 'diana'), (select "id" from "role" where "name" = 'guest'));

-- Rights for new roles and channels
insert into "right" ("role_id", "channel_id", "rights")
values
    ((select "id" from "role" where "name" = 'moderator'), (select "id" from "channel" where "name" = 'general'), 'RW'),
    ((select "id" from "role" where "name" = 'moderator'), (select "id" from "channel" where "name" = 'development'), 'RW'),
    ((select "id" from "role" where "name" = 'guest'), (select "id" from "channel" where "name" = 'general'), 'R'),
    ((select "id" from "role" where "name" = 'member'), (select "id" from "channel" where "name" = 'general'), 'RW'),
    ((select "id" from "role" where "name" = 'member'), (select "id" from "channel" where "name" = 'development'), 'RW'),
    ((select "id" from "role" where "name" = 'member'), (select "id" from "channel" where "name" = 'random'), 'RW');


-- Sample messages
insert into "message" ("sender_id", "channel_id", "content")
values
    ((select "id" from "user" where "username" = 'alice'), (select "id" from "channel" where "name" = 'general'), 'Hey everyone, glad to be here!'),
    ((select "id" from "user" where "username" = 'bob'), (select "id" from "channel" where "name" = 'default'), 'Good morning!'),
    ((select "id" from "user" where "username" = 'charlie'), (select "id" from "channel" where "name" = 'development'), 'Working on a new feature, updates coming soon.'),
    ((select "id" from "user" where "username" = 'alice'), (select "id" from "channel" where "name" = 'general'), 'Does anyone have experience with PostgreSQL?'),
    ((select "id" from "user" where "username" = 'diana'), (select "id" from "channel" where "name" = 'general'), 'Hello! Just joined the server.'),
    ((select "id" from "user" where "username" = 'bob'), (select "id" from "channel" where "name" = 'random'), 'Anyone up for some gaming later?'),
    ((select "id" from "user" where "username" = 'admin'), (select "id" from "channel" where "name" = 'default'), 'Welcome all new users!');