/**
 * Mock 用户数据（iam 域）
 *
 * 维护者：ai13（teacher-portal）
 * 关联：contract.md §4.2 MSW 拦截策略
 */

import type { User } from "@/lib/graphql";

export const mockUser: User = {
  id: "550e8400-e29b-41d4-a716-446655440001",
  email: "teacher@edu.test",
  name: "张老师",
  roles: ["teacher"],
  dataScope: "GRADE",
};

/** localStorage 中存储的 UserInfo（含 permissions 字段） */
export const mockUserInfo = {
  ...mockUser,
  permissions: [
    "DASHBOARD_READ",
    "VIEWPORT_READ",
    "CLASS_READ",
    "CLASS_READ_OWN",
    "STUDENT_READ_OWN",
    "EXAM_READ_OWN",
    "HOMEWORK_READ_OWN",
    "GRADE_READ_OWN",
    "GRADE_READ_CHILD",
    "USER_READ_OWN",
  ],
};

/** Mock JWT token（与 api-gateway DEV_MODE 公钥配对） */
export const mockToken =
  "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." +
  btoa(JSON.stringify(mockUserInfo)) +
  ".mock-signature";
