# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/diagnostics/data/self_test_report.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List

import blickfeld_qb2.betterproto as betterproto
import blickfeld_qb2.betterproto.lib.google.protobuf as betterproto_lib_google_protobuf

from .. import config as _config__


class SelfTestReportResultFlag(betterproto.Enum):
    """Result flags which indicates if test was sucessful."""

    FLAG_UNSPECIFIED = 0
    """Unknown result."""

    FLAG_SUCCESS = 1
    """The test was successful."""

    FLAG_WARNING = 2
    """
    The test suceeded but it raised some warnings. Please report if this
    happens during production and the root-cause is unknown.
    """

    FLAG_FAILURE = 3
    """The test failed. The tested module is most probably not functional."""


@dataclass(eq=False, repr=False)
class SelfTestReport(betterproto.Message):
    """Report which contains the results of the selected self tests."""

    result_flag: "SelfTestReportResultFlag" = betterproto.enum_field(1)
    """
    Aggregated result flag which is FLAG_SUCCESS if all tests passed without
    warnings
    """

    results: List["SelfTestReportResult"] = betterproto.message_field(2)
    """List of test results"""


@dataclass(eq=False, repr=False)
class SelfTestReportResult(betterproto.Message):
    """Result of test."""

    test: "_config__.SelfTest" = betterproto.enum_field(1)
    """Test case"""

    identifier: str = betterproto.string_field(5)
    """Unique identifier of test case"""

    flag: "SelfTestReportResultFlag" = betterproto.enum_field(2)
    """Flag which states test result"""

    reason: str = betterproto.string_field(3)
    """
    Human-readable reason for test warning or failure. Is not set if test was
    successful.
    """

    duration: float = betterproto.float_field(4)
    """Duration of test run"""
