<?php

namespace App;

class Answers extends Entity
{
    protected $fillable = [
        'title', 'answer_a', 'answer_b', 'answer_c', 'answer_d', 'correct_answer'
    ];

    const nav = '在线答题';

    public const columns = [
        'id' => 'ID',
        'title' => '题目',
        'answer_a' => 'A选项',
        'answer_b' => 'B选项',
        'answer_c' => 'C选项',
        'answer_d' => 'D选项',
        'correct_answer' => '正确选项'
    ];

    const searchFields = [
        [
            'name' =>'title',
            'description' => '标题',
            'type' => 'like'
        ]
    ];

    public const createFields = [
      [
          'name'=> 'title', 'description' => '标题', 'type' => 'string'
      ],
      [
          'name' => 'answer_a', 'description' => 'A选项', 'type' => 'string'
      ],
        [
            'name' => 'answer_b', 'description' => 'B选项', 'type' => 'string'
        ],
        [
            'name' => 'answer_c', 'description' => 'C选项', 'type' => 'string'
        ],
        [
            'name' => 'answer_d', 'description' => 'D选项', 'type' => 'string'
        ],
        [
            'name' => 'correct_answer', 'description' => '正确选项', 'type' => 'select',
            'options' => [
                [
                    'id' => 'A',
                    'name' => 'A'
                ],
                [
                    'id' => 'B',
                    'name' => 'B'
                ],
                [
                    'id' => 'C',
                    'name' => 'C'
                ],
                [
                    'id' => 'D',
                    'name' => 'D'
                ]
            ]
        ]
    ];

    public const editFields = self::createFields;

    protected $isDelete = true;
}
