-- +goose Up
CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    email TEXT NOT NULL,
    email_hash TEXT NOT NULL UNIQUE,
    password_hash TEXT NOT NULL,
    phone TEXT,
    user_name TEXT,
    company_name TEXT,
    balance NUMERIC(10, 5) DEFAULT 0.0,
    payment_status TEXT DEFAULT 'unpaid',
    invites_issued INT DEFAULT 0,
    invites_limit INT DEFAULT 10,
    created_at TIMESTAMP DEFAULT now()
);

CREATE INDEX IF NOT EXISTS idx_users_email_hash ON users(email_hash);

-- +goose Down
DROP TABLE users;
