<?php

declare(strict_types=1);

namespace Kylin\Medical\Enums;

/**
 * 药品管控类别
 */
enum DrugCategory: string
{
    case NORMAL = 'normal';                     // 普通药品
    case PRESCRIPTION = 'prescription';         // 处方药
    case CONTROLLED = 'controlled';             // 管制药品
    case NARCOTIC = 'narcotic';                 // 麻醉药品
    case PSYCHOTROPIC = 'psychotropic';         // 精神药品

    public function label(): string
    {
        return match ($this) {
            self::NORMAL => '普通药品',
            self::PRESCRIPTION => '处方药',
            self::CONTROLLED => '管制药品',
            self::NARCOTIC => '麻醉药品',
            self::PSYCHOTROPIC => '精神药品',
        };
    }

    /**
     * 是否允许在线开具
     */
    public function canPrescribeOnline(): bool
    {
        return !in_array($this, [self::NARCOTIC, self::PSYCHOTROPIC], true);
    }
}
