<?php

declare(strict_types=1);

namespace App\Business\DataImport\Enums;

use App\Support\Concerns\TranslatesDberpBackedEnumLabel;

enum DataImportType: string
{
    use TranslatesDberpBackedEnumLabel;

    case Unit = 'unit';
    case ProductCategory = 'product_category';
    case ProductBrand = 'product_brand';
    case CustomerCategory = 'customer_category';
    case SupplierCategory = 'supplier_category';
    case Warehouse = 'warehouse';
    case Customer = 'customer';
    case Supplier = 'supplier';
    case Product = 'product';
    case OpeningStock = 'opening_stock';

    /**
     * 首批基础版已支持的导入类型（不含期初应收/应付、多规格商品、员工/业务员等后续能力）。
     *
     * @return list<self>
     */
    public static function supportedWorkflowTypes(): array
    {
        return self::cases();
    }

    /**
     * @return array<string, string>
     */
    public static function supportedOptions(): array
    {
        $options = [];

        foreach (self::supportedWorkflowTypes() as $type) {
            $options[$type->value] = $type->label();
        }

        return $options;
    }

    /**
     * @return list<self>
     */
    public static function firstStageTypes(): array
    {
        return self::supportedWorkflowTypes();
    }

    public function isFirstStage(): bool
    {
        return true;
    }
}
