#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
# openUBMC is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#         http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.

from .base import BaseValidator
from .protocol import ProtocolValidator
from .service import ServiceValidator
from .interop import InteropValidator

# 验证器类型映射
VALIDATOR_MAP = {
    "protocol": ProtocolValidator,
    "service": ServiceValidator,
    "interop": InteropValidator,
    "redfish_protocol_validator": ProtocolValidator,
    "redfish_service_validator": ServiceValidator,
    "redfish_interop_validator": InteropValidator,
}


def create_validator(validator_type: str) -> BaseValidator:
    """
    工厂函数：创建验证器实例
    :param validator_type: 验证器类型
    :return: 验证器实例
    """
    validator_class = VALIDATOR_MAP.get(validator_type.lower())
    if validator_class is None:
        raise ValueError(f"不支持的验证器类型: {validator_type}")
    return validator_class()


__all__ = ['BaseValidator', 'ProtocolValidator', 'ServiceValidator', 'InteropValidator', 'create_validator']
