import type { DefaultSession } from 'next-auth';
import 'next-auth';

declare module 'next-auth' {
  interface Session {
    accessToken?: string;
    roles?: string[];
    /** Optional tenant scope for billing/dashboard GraphQL */
    clientId?: string;
    tenantId?: string;
    subscriptionId?: string;
    user?: DefaultSession['user'] & {
      id?: string;
      role?: string;
    };
  }

  interface User {
    id?: string;
    role?: string;
    roles?: string[];
  }
}

declare module 'next-auth/jwt' {
  interface JWT {
    accessToken?: string;
    refreshToken?: string;
    idToken?: string;
    roles?: string[];
    clientId?: string;
    tenantId?: string;
    subscriptionId?: string;
  }
}
