{
  "metadata": {
    "generated_at": "2026-06-03T06:55:22.033529+00:00",
    "stage": "HRMS_REAL_USER_MASTER_DATA_IMPORT_PREP_PACK_X"
  },
  "allowed_file_types": [
    "csv",
    "xlsx"
  ],
  "max_trial_size": {
    "employees": 50,
    "departments": 20,
    "positions": 30,
    "feishu_mappings": 50
  },
  "sensitive_data_handling": [
    "不输出手机号、邮箱、身份证号明文",
    "导入前本地校验并脱敏展示",
    "Feishu open_id/user_id 仅用于映射准备，禁止写回"
  ],
  "employee_file_rules": {
    "required_columns": [
      "employee_code",
      "display_name",
      "department_code",
      "position_code",
      "manager_employee_code",
      "employment_status",
      "trial_scope",
      "real_trial_prefix"
    ],
    "optional_columns": [
      "job_level",
      "location",
      "business_unit",
      "feishu_user_key_masked"
    ],
    "unique_constraints": [
      "employee_code"
    ],
    "foreign_key_like_checks": [
      "department_code exists",
      "position_code exists",
      "manager_employee_code exists or blank for root"
    ]
  },
  "department_file_rules": {
    "required_columns": [
      "department_code",
      "department_name",
      "parent_department_code",
      "trial_scope",
      "real_trial_prefix"
    ],
    "optional_columns": [
      "department_type",
      "business_unit"
    ],
    "unique_constraints": [
      "department_code"
    ],
    "foreign_key_like_checks": [
      "parent_department_code exists or blank for root"
    ]
  },
  "position_file_rules": {
    "required_columns": [
      "position_code",
      "position_name",
      "department_code",
      "job_family",
      "job_level",
      "trial_scope",
      "real_trial_prefix"
    ],
    "optional_columns": [
      "position_status",
      "critical_position_flag"
    ],
    "unique_constraints": [
      "position_code"
    ],
    "foreign_key_like_checks": [
      "department_code exists"
    ]
  },
  "feishu_mapping_file_rules": {
    "required_columns": [
      "employee_code",
      "feishu_user_key_masked",
      "feishu_department_key_masked",
      "mapping_status",
      "trial_scope",
      "real_trial_prefix"
    ],
    "optional_columns": [
      "sync_allowed_future",
      "writeback_allowed"
    ],
    "unique_constraints": [
      "employee_code"
    ],
    "foreign_key_like_checks": [
      "employee_code exists",
      "department_code aligned through employee department"
    ]
  },
  "required_columns": {
    "employee": [
      "employee_code",
      "display_name",
      "department_code",
      "position_code",
      "real_trial_prefix"
    ],
    "department": [
      "department_code",
      "department_name",
      "real_trial_prefix"
    ],
    "position": [
      "position_code",
      "position_name",
      "department_code",
      "real_trial_prefix"
    ],
    "feishu_mapping": [
      "employee_code",
      "feishu_user_key_masked",
      "feishu_department_key_masked",
      "real_trial_prefix"
    ]
  },
  "optional_columns": [
    "tenant_id",
    "company_key",
    "data_version",
    "source_file_ref",
    "audit_ref",
    "rollback_ref"
  ],
  "duplicate_detection": [
    "employee_code duplicate",
    "department_code duplicate",
    "position_code duplicate",
    "feishu mapping duplicate",
    "same employee mapped to multiple Feishu users"
  ],
  "validation_error_codes": [
    "REAL_SOURCE_DATA_MISSING",
    "MISSING_REQUIRED_COLUMN",
    "DUPLICATE_BUSINESS_KEY",
    "ORPHAN_DEPARTMENT",
    "ORPHAN_POSITION",
    "MISSING_MANAGER_REF",
    "MISSING_PERMISSION_SUBJECT_REF",
    "FEISHU_MAPPING_UNRESOLVED",
    "REAL_TRIAL_PREFIX_MISSING",
    "SENSITIVE_FIELD_NOT_MASKED"
  ]
}
