/*
 * 登录的状态类
 */
import 'package:cs_resources/generated/l10n.dart';
import 'package:flutter/material.dart';

class ForgotInputState {
  //表单的校验与数据
  final Map<String, Map<String, dynamic>> formData;

  //表单的错误信息展示
  String? emailErrorText;
  String? phoneErrorText;

  String? countryCode; //用户选择的区号

  // ===================================  Begin  ↓  ===================================

  ForgotInputState({
    Map<String, Map<String, dynamic>>? formData,
    this.emailErrorText,
    this.phoneErrorText,
    this.countryCode,
  }) : formData = formData ??
            {
              'email': {
                'value': '',
                'controller': TextEditingController(),
                'hintText': S.current.email,
                'focusNode': FocusNode(),
                'obsecure': false,
              },
              'phone': {
                'value': '',
                'controller': TextEditingController(),
                'hintText': S.current.mobile_phone,
                'focusNode': FocusNode(),
                'obsecure': false,
              },
            };

  ForgotInputState copyWith({
    String? emailErrorText,
    String? phoneErrorText,
    String? countryCode,
  }) {
    return ForgotInputState(
      formData: this.formData,
      emailErrorText: emailErrorText,
      phoneErrorText: phoneErrorText,
      countryCode: countryCode ?? this.countryCode,
    );
  }
}
