fromUserResponse static method

ClientUserEntity fromUserResponse({
  1. required UserResponse response,
})

Implementation

static ClientUserEntity fromUserResponse({
  required UserResponse response,
}) =>
    ClientUserEntity(
      id: response.clientUser?.id ?? 0,
      name: response.clientUser?.name ?? '',
      company: response.clientUser?.company ?? '',
      jurStatus: JurStatus.values.firstWhere(
        (JurStatus status) =>
            status.shortName == (response.clientUser?.jurStatus ?? 'J'),
      ),
      jurAddress: response.clientUser?.jurAddress ?? '',
      registrationDate: response.clientUser?.registrationDate ?? '',
      registrationAuthority: response.clientUser?.registrationAuthority ?? '',
      taxId: response.clientUser?.taxId ?? '',
      email: response.clientUser?.email ?? '',
      emailConfirmed: response.clientUser?.emailConfirmed ?? false,
      phone: response.clientUser?.phone ?? '',
      // if sales_rep_id > 0 true
      // if sales_rep_id  == 0 false
      isSalesRep:
          response.clientUser != null && response.clientUser!.salesRepId > 0,
    );