import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { AuditEvent, SessionPermissions } from '../models/permission.model';
import { PermissionGateway } from './permission-gateway.interface';

/**
 * Grants full PLATFORM_OWNER access unconditionally. This matches today's
 * REAL behaviour (GAPS-AND-IMPROVEMENTS.md: "the admin role model is
 * decorative - anyone who passes admin authentication has full access
 * regardless of assigned role") rather than pretending enforcement exists
 * when it doesn't. Swapping PERMISSION_GATEWAY for a real backend per
 * docs/backend/TRACK-S-SECURITY-RBAC-CONTRACT.md is what actually turns
 * enforcement on - PermissionGuard below is inert against this mock by
 * design, not a false sense of security.
 */
@Injectable({ providedIn: 'root' })
export class PermissionLocalGateway implements PermissionGateway {
  getSessionPermissions(): Observable<SessionPermissions> {
    return of({ role: 'PLATFORM_OWNER', scopes: ['*'], marketplaceIds: ['*'] });
  }

  loadAuditLog(): Observable<AuditEvent[]> {
    return of([]);
  }
}
