-- CREATE SETUP

BEGIN;

    INSERT INTO doki8902.post_category(name) VALUES
        ('Technology'),
        ('Food'),
        ('Games'),
        ('Reading'),
        ('Movies'),
        ('Sports');

COMMIT;

-- CREATE USERS
    
BEGIN;

    INSERT INTO doki8902.user(username, password) VALUES
        ('Alice', 'pass123'),
        ('Bob', 'qwerty'),
        ('Charlie', 'abc456'),
        ('BotAccount', 'qwertyasdf');

    INSERT INTO doki8902.user_permission(user_id, permission, state) VALUES 
        (1, 'delete', TRUE),
        (1, 'edit', TRUE),
        (2, 'admin', TRUE),
        (4, 'post', FALSE);

COMMIT;

-- NORMAL USE

SELECT doki8902.func_log_user_restrict(2, 'Spam and botting');

INSERT INTO message_post(author_id, category_id, name, latest_content) VALUES
    (3, 2, 'What''s your favorite dessert?', 'Personally, I like Ice Cream');

INSERT INTO message_comment (author_id, post_id, latest_content, parent_comment_id) VALUES
    (2, 1, 'Chocolate Mousse', NULL);
