{
  "schemaVersion": 1,
  "atomId": "match3_core.aigameplay",
  "bundleType": "aigameplay",
  "category": "gameplay",
  "mode": "fixed",
  "label": { "zh": "三消核心玩法", "en": "Match-3 core gameplay" },
  "tags": ["gameplay", "match3", "casual", "grid", "eliminate", "core"],
  "bindingRoles": ["gameplayRule"],
  "imports": [
    { "slot": "engine",      "pinAtomId": "phaser.aicomponent",          "edgeKind": "requires",      "bindAs": "engine" },
    { "slot": "boardLayout", "pinAtomId": "grid_board_layout.aicomponent","edgeKind": "requires",      "bindAs": "boardLayout" },
    {
      "slot": "bgMusic",
      "description": "背景循环音乐",
      "bindAs": "bgm",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["bgMusic"],
      "allowedBundleTypes": ["aiaudio"],
      "constraints": { "loop": true }
    },
    {
      "slot": "tileSet",
      "description": "牌面贴图组（三消块的视觉贴图集）",
      "bindAs": "tiles",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["tileTextureSet"],
      "allowedBundleTypes": ["aiimage"]
    },
    {
      "slot": "background",
      "description": "游戏背景图",
      "bindAs": "bg",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["backgroundTexture"],
      "allowedBundleTypes": ["aiimage"]
    },
    {
      "slot": "levelDataPack",
      "description": "关卡数据包",
      "bindAs": "levels",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["levelDataPack"],
      "allowedBundleTypes": ["aiconfig"]
    },
    {
      "slot": "winPanel",
      "description": "通关反馈面板视觉",
      "bindAs": "winPanel",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["successFeedbackPanel"],
      "allowedBundleTypes": ["aiimage"]
    },
    {
      "slot": "losePanel",
      "description": "失败反馈面板视觉",
      "bindAs": "losePanel",
      "required": false,
      "edgeKind": "compatibleWith",
      "matchBindingRoles": ["failFeedbackPanel"],
      "allowedBundleTypes": ["aiimage"]
    }
  ],
  "generation": {
    "kind": "pgs",
    "pgsVersion": "1.0",
    "gameplayType": "match3",
    "rules": {
      "minMatchCount": 3,
      "swapDirection": "orthogonal",
      "gravityDirection": "down",
      "refillFromTop": true
    }
  },
  "result": {
    "outputFile": "reducer.ts",
    "format": "typescript",
    "constraints": { "testCasesMustPass": true }
  },
  "binding": {
    "role": "gameplayRule",
    "target": "game/gameplay/match3/reducer.ts",
    "type": "gameplay-module-reference",
    "constraints": {
      "interface": [
        "init(config)", "dispatch(action)", "getState()",
        "trySwap(state, from, to)",
        "findAllMatches(board, cols, rows)",
        "removeMatches(board, matches)",
        "applyGravity(board, cols, rows)",
        "refillBoard(board, cols, rows, colorCount)",
        "calculateMatchScore(matches, config)",
        "hasValidMoves(state)"
      ]
    }
  },
  "files": {
    "skill": "SKILL.md",
    "pgsSchema": "ref/pgs-schema.json",
    "reducerTemplate": "ref/reducer.template.ts"
  }
}
