import type { Difficulty } from './data/accounts' /** 仕訳1行 */ export interface Entry { account: string amount: number } /** 記号と勘定科目のペア(語群) */ export interface SymbolChoice { symbol: string // 'ア', 'イ', 'ウ' ... account: string } /** 証憑・資料(納品書・請求書等)の構造化データ */ export interface ProblemDocument { type: 'table' title?: string headers: string[] rows: string[][] } /** 生成・保管される問題 */ export interface Problem { id: string section: 'journal' topic: string difficulty: Difficulty event_text: string /** 証憑テーブル等の添付資料 */ documents?: ProblemDocument[] /** 語群(記号→勘定科目)。未設定時は choices から自動生成 */ symbols?: SymbolChoice[] debit: Entry[] credit: Entry[] /** 後方互換:symbols が無い旧データ用 */ choices: string[] hint: string | null explanation: string } export type { Difficulty } // ============================================================ // 第2問: 勘定記入 // ============================================================ export type LedgerCellType = 'given' | 'blank_symbol' | 'blank_amount' | 'blank_date' export interface LedgerCell { type: LedgerCellType value?: string | number answer?: string | number scored: boolean } export interface LedgerRow { left: { date: LedgerCell; desc: LedgerCell; amount: LedgerCell } right: { date: LedgerCell; desc: LedgerCell; amount: LedgerCell } } export interface LedgerProblem { id: string section: 'ledger' topic: string account_name: string event_text: string documents?: ProblemDocument[] word_bank: SymbolChoice[] rows: LedgerRow[] hint: string | null explanation: string } export interface LedgerResult { correct: boolean score: number total: number cellResults: boolean[][] } // ============================================================ // 第3問: 財務諸表 // ============================================================ export type StatementCellType = | 'given_label' | 'given_amount' | 'blank_amount' | 'blank_contra' // △表記の絶対値入力(answer=絶対値, answer2=純額) | 'blank_account' // 勘定科目名入力(suffix: 後置テキスト例 '消費税') export interface StatementCell { type: StatementCellType value?: string | number | null answer?: string | number answer2?: number // blank_contra のみ: 純額(= 元資産 - contra) suffix?: string // blank_account のみ: 後置テキスト } export interface StatementRow { left: { label: StatementCell; amount: StatementCell } right: { label: StatementCell; amount: StatementCell } } export interface StatementProblem { id: string section: 'statement' topic: string event_text: string documents?: ProblemDocument[] bs_rows: StatementRow[] hint: string | null explanation: string } export interface StatementResult { correct: boolean score: number total: number rowResults: { rowIndex: number; leftOk: boolean; rightOk: boolean }[] }