import 'package:formz/formz.dart';

enum TransactionDescriptionValidationError {
  empty('Description empty'),
  invalid('Description invalid');

  final String message;
  const TransactionDescriptionValidationError(this.message);
}

class TransactionDescription extends FormzInput<String, TransactionDescriptionValidationError> {
  const TransactionDescription.pure() : super.pure('');
  const TransactionDescription.dirty([super.value = '']) : super.dirty();

  @override
  TransactionDescriptionValidationError? validator(String value) {
    return value.isEmpty ? TransactionDescriptionValidationError.empty : null;
  }
}