| 14 | |
| 15 | @dataclass(frozen=True) |
| 16 | class ValidationResult: |
| 17 | result: bool |
| 18 | message: str = "" |
| 19 | error_code: int = 0 |
| 20 | |
| 21 | @staticmethod |
| 22 | def ok() -> ValidationResult: |
| 23 | return ValidationResult(result=True) |
| 24 | |
| 25 | @staticmethod |
| 26 | def fail(message: str, error_code: int = 0) -> ValidationResult: |
| 27 | return ValidationResult(result=False, message=message, error_code=error_code) |
| 28 | |
| 29 | |
| 30 | @dataclass(frozen=True) |