code: public function map($resource, array $data): ResourceClass
      {
          /** @var SystemProperties $sys */
          $sys = $this->createSystemProperties(SystemProperties::class, $data);
          $locale = $sys->getLocale();
  
          // We normalize the field data to always contain locales.
          foreach ($data['fields'] ?? [] as $name => $value) {
              // If the value is an empty array, and no locale was used,
              // we remove the value as the entry itself will handle default values.
              if (!$locale && $value === []) {
                  unset($data['fields'][$name]);
                  continue;
              }
  
              $data['fields'][$name] = $locale ? [$locale => $value] : $value;
          }
  
          /** @var ResourceClass $entry */
          $entry = $this->hydrator->hydrate($resource ?: ResourceClass::class, [
              'sys' => $sys,
              'client' => $this->client,
              'fields' => isset($data['fields'])
                  ? $this->buildFields($sys->getContentType(), $data['fields'], $resource)
                  : [],
          ]);
  
          $entry->initLocales($entry->getSystemProperties()->getEnvironment()->getLocales());
  
          return $entry;
      }
docs: {@inheritdoc}