{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://upstage.ai/design-system/schemas/self-check/0.1.0",
  "title": "Lift Agent Self-Check",
  "description": "모든 결과 마지막에 붙일 검수 구조. agent의 자기보고이며 최종 판정 아님. 사람 reviewer 1명이 추가 검수.",
  "type": "object",
  "required": [
    "contextMatch",
    "tokenIntentUsage",
    "forbiddenRules",
    "codeSafety",
    "humanReviewNeeded"
  ],
  "additionalProperties": false,
  "properties": {
    "contextMatch": {
      "type": "object",
      "required": ["status", "context"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail"]
        },
        "context": {
          "type": "string",
          "enum": ["product", "website", "marketing"]
        },
        "notes": { "type": "string" }
      }
    },
    "tokenIntentUsage": {
      "type": "object",
      "required": ["status", "used"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail"]
        },
        "used": {
          "type": "array",
          "items": { "type": "string" },
          "description": "예: [\"action.primary\", \"surface.default\", \"text.secondary\"]"
        },
        "unknown": {
          "type": "array",
          "items": { "type": "string" },
          "description": "token-intents.json에 없는 intent를 agent가 추가로 사용한 경우"
        },
        "notes": { "type": "string" }
      }
    },
    "forbiddenRules": {
      "type": "object",
      "required": ["status", "violations"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail"]
        },
        "violations": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["ruleId", "where"],
            "properties": {
              "ruleId": {
                "type": "string",
                "description": "예: P-7 (Raw hex)"
              },
              "where": {
                "type": "string",
                "description": "파일 path 또는 위치"
              },
              "snippet": { "type": "string" },
              "note": { "type": "string" }
            }
          }
        },
        "exceptionsClaimed": {
          "type": "array",
          "items": { "type": "string" },
          "description": "예: [\"EX-1: Website Announcement Bar\"]"
        }
      }
    },
    "codeSafety": {
      "type": "object",
      "required": ["rawHex", "fallbackHex", "magicZIndex", "textGradient"],
      "properties": {
        "rawHex": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "fallbackHex": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "magicZIndex": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "textGradient": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "notes": { "type": "string" }
      }
    },
    "copyTone": {
      "type": "object",
      "description": "Optional — copy 작업일 때만 채움.",
      "properties": {
        "status": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail"]
        },
        "language": { "type": "string", "enum": ["ko", "en", "mixed"] },
        "notes": {
          "type": "string",
          "description": "Upstage 톤 — precise / confident / trustworthy. 버즈워드 회피"
        }
      }
    },
    "brandRules": {
      "type": "object",
      "description": "Optional — B-1~B-8 브랜드 규칙 검토.",
      "properties": {
        "b1DeclarationBeforeExplanation": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b2EvidenceIsDesign": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b3FeaturedCardOnePerGrid": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b4AlternateSurfaces": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b5OnePrimaryCta": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b6HighlightIsPunctuation": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b7SemanticOverPrimitive": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        },
        "b8CategoricalThreeStepSet": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"]
        }
      }
    },
    "uxQuality": {
      "type": "object",
      "description": "Optional — 화면·흐름이 있는 작업일 때 채움. 시각 규칙과 별개로 사용자가 막히지 않는지 본다. 체크리스트 §7 UX 항목과 같다.",
      "properties": {
        "errorRecovery": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "에러 메시지가 원인과 해결 방법(다음 행동)을 함께 알려 주는가"
        },
        "costDisclosure": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "비용·사용량·시간이 드는 동작에 실행 전 예상치를 보여 주는가"
        },
        "aiLimitations": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "AI 결과에 한계·검토 필요 여부·처리 상태를 표시하는가"
        },
        "cancelUndo": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "긴 작업은 취소, 파괴적 동작은 확인 또는 되돌리기가 있는가"
        },
        "disabledReason": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "비활성 컨트롤에 왜 쓸 수 없고 어떻게 풀리는지 알려 주는가"
        },
        "emptyStateKinds": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "처음 비어 있음 · 검색·필터 결과 없음 · 권한 없음 · 불러오기 실패를 구분하는가"
        },
        "touchTarget": {
          "type": "string",
          "enum": ["pass", "needs-review", "fail", "n/a"],
          "description": "터치 환경에서 대상이 --hit-target-min 이상이고 hover에만 의존하지 않는가"
        },
        "notes": { "type": "string" }
      }
    },
    "humanReviewNeeded": {
      "type": "array",
      "items": { "type": "string" },
      "description": "agent가 사람 reviewer가 확인해야 한다고 본 항목."
    },
    "limitations": {
      "type": "array",
      "items": { "type": "string" },
      "description": "agent가 인지한 자기 한계. 예: \"실제 컴포넌트 visual 검증 불가\""
    }
  },
  "examples": [
    {
      "contextMatch": {
        "status": "pass",
        "context": "product",
        "notes": "Matches console/product UI."
      },
      "tokenIntentUsage": {
        "status": "pass",
        "used": ["action.primary", "surface.default", "text.secondary"],
        "unknown": []
      },
      "forbiddenRules": {
        "status": "pass",
        "violations": [],
        "exceptionsClaimed": []
      },
      "codeSafety": {
        "rawHex": "pass",
        "fallbackHex": "pass",
        "magicZIndex": "pass",
        "textGradient": "pass"
      },
      "copyTone": {
        "status": "needs-review",
        "language": "ko",
        "notes": "한국어 copy 톤은 사람 reviewer 확인 권장"
      },
      "humanReviewNeeded": [
        "Confirm final copy tone",
        "Confirm route placement"
      ],
      "limitations": ["실제 컴포넌트 visual 검증 불가 (텍스트 기반 작업)"]
    }
  ]
}
