CREATE TYPE event_type AS ENUM ('sports', 'meetings', 'drama', 'music', 'other');

CREATE TABLE events (
    id SERIAL PRIMARY KEY,
    title VARCHAR(255),
    time_start TIMESTAMP,
    time_end TIMESTAMP,
    event_type event_type,
    points INTEGER,
    place VARCHAR(255),
    price DECIMAL(10, 2),
    created_by INTEGER REFERENCES users(id)
);

CREATE TABLE event_attendees (
    event_id INTEGER REFERENCES events(id),
    user_id INTEGER REFERENCES users(id),
    PRIMARY KEY (event_id, user_id)
);

CREATE INDEX idx_event_attendees ON event_attendees(event_id);
