-- =============================================================================
-- BeKind Backend — Auth Social Login (Future)
-- Table: user_social_accounts
-- Purpose: Social login integration (Google, Facebook, GitHub, etc.)
-- Depends on: 001-auth-schema.sql (users)
--
-- FUTURE: Uncomment and run this migration when implementing OAuth2 social login
-- =============================================================================

-- Social accounts table (for OAuth2 providers like Google, Facebook, GitHub)
-- Uncomment below when implementing social login

-- CREATE TABLE IF NOT EXISTS user_social_accounts (
--     id                    UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
--     user_id               UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
--     provider              VARCHAR(50) NOT NULL,
--     provider_user_id      VARCHAR(255) NOT NULL,
--     linked_at             TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
--     access_token_encrypted BYTEA,
--     refresh_token_encrypted BYTEA,
--     expires_at            TIMESTAMP WITH TIME ZONE,
--     metadata              JSONB DEFAULT '{}'::jsonb,
--
--     UNIQUE (user_id, provider, provider_user_id),
--     UNIQUE (provider, provider_user_id)
-- );

-- =============================================================================
-- INDEXES
-- =============================================================================

-- CREATE INDEX IF NOT EXISTS idx_user_social_accounts_user_id          ON user_social_accounts(user_id);
-- CREATE INDEX IF NOT EXISTS idx_user_social_accounts_provider          ON user_social_accounts(provider);
-- CREATE INDEX IF NOT EXISTS idx_user_social_accounts_provider_user_id  ON user_social_accounts(provider_user_id);
