<?php

declare(strict_types=1);

namespace Kylin\Education\Enums;

/**
 * 题目类型
 */
enum QuestionType: string
{
    case SINGLE_CHOICE = 'single_choice';   // 单选
    case MULTI_CHOICE = 'multi_choice';     // 多选
    case JUDGMENT = 'judgment';             // 判断
    case FILL_BLANK = 'fill_blank';         // 填空
    case SHORT_ANSWER = 'short_answer';     // 简答

    public function label(): string
    {
        return match ($this) {
            self::SINGLE_CHOICE => '单选题',
            self::MULTI_CHOICE => '多选题',
            self::JUDGMENT => '判断题',
            self::FILL_BLANK => '填空题',
            self::SHORT_ANSWER => '简答题',
        };
    }

    /**
     * 是否为客观题（可自动阅卷）
     */
    public function isObjective(): bool
    {
        return in_array($this, [self::SINGLE_CHOICE, self::MULTI_CHOICE, self::JUDGMENT, self::FILL_BLANK]);
    }
}
