private function getProperties(array $mainVariation)
    {
        $result = [];

        $properties = $mainVariation['variationProperties'];

        foreach ($properties as $property) {
            if (!$property['property']['isSearchable']) {
                continue;
            }

            $backendName = $property['property']['backendName'];

            $values = [];
            $translations = [];

            if ($property['property']['valueType'] === 'empty' && null !== $property['property']['propertyGroupId']) {
                $propertyGroupNames = $this->itemsPropertiesGroupsNamesApi->findOne($property['property']['propertyGroupId']);

                if (empty($propertyGroupNames[0]['name'])) {
                    continue;
                }

                $backendName = $propertyGroupNames[0]['name'];

                foreach ($propertyGroupNames as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $name['name'],
                    ]);
                }

                $propertyNames = $this->itemsPropertiesNamesApi->findOne($property['property']['id']);
                $valueTranslations = [];

                foreach ($propertyNames as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $name['name'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['property']['backendName'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'text') {
                if (empty($property['names'][0]['value'])) {
                    continue;
                }

                $valueTranslations = [];

                foreach ($property['names'] as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $property['property']['backendName'],
                    ]);

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $name['value'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['names'][0]['value'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'selection') {
                if (null === $property['propertySelectionId']) {
                    continue;
                }

                $valueTranslations = [];

                foreach ($property['propertySelection'] as $selection) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $selection['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $property['property']['backendName'],
                    ]);

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $selection['name'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['propertySelection'][0]['name'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'int') {
                if (null === $property['valueInt']) {
                    continue;
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['valueInt'],
                ]);
            } elseif ($property['property']['valueType'] === 'float') {
                if (null === $property['valueFloat']) {
                    continue;
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['valueFloat'],
                ]);
            } elseif ($property['property']['valueType'] === 'file') {
                $this->logger->notice('file properties are not supported', ['variation', $mainVariation['id']]);

                continue;
            }

            $result[] = Property::fromArray([
                'name' => $backendName,
                'values' => $values,
                'translations' => $translations,
            ]);
        }

        return $result;
    }
private function getProperties(array $mainVariation)
    {
        $result = [];

        $properties = $mainVariation['variationProperties'];

        foreach ($properties as $property) {
            if (!$property['property']['isSearchable']) {
                continue;
            }

            $backendName = $property['property']['backendName'];

            $values = [];
            $translations = [];

            if ($property['property']['valueType'] === 'empty' && null !== $property['property']['propertyGroupId']) {
                $propertyGroupNames = $this->itemsPropertiesGroupsNamesApi->findOne($property['property']['propertyGroupId']);

                if (empty($propertyGroupNames[0]['name'])) {
                    continue;
                }

                $backendName = $propertyGroupNames[0]['name'];

                foreach ($propertyGroupNames as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $name['name'],
                    ]);
                }

                $propertyNames = $this->itemsPropertiesNamesApi->findOne($property['property']['id']);
                $valueTranslations = [];

                foreach ($propertyNames as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $name['name'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['property']['backendName'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'text') {
                if (empty($property['names'][0]['value'])) {
                    continue;
                }

                $valueTranslations = [];

                foreach ($property['names'] as $name) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $name['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $property['property']['backendName'],
                    ]);

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $name['value'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['names'][0]['value'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'selection') {
                if (null === $property['propertySelectionId']) {
                    continue;
                }

                $valueTranslations = [];

                foreach ($property['propertySelection'] as $selection) {
                    $languageIdentifier = $this->identityService->findOneBy([
                        'adapterIdentifier' => $selection['lang'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => Language::TYPE,
                    ]);

                    if (null === $languageIdentifier) {
                        continue;
                    }

                    $translations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'name',
                        'value' => $property['property']['backendName'],
                    ]);

                    $valueTranslations[] = Translation::fromArray([
                        'languageIdentifier' => $languageIdentifier->getObjectIdentifier(),
                        'property' => 'value',
                        'value' => $selection['name'],
                    ]);
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['propertySelection'][0]['name'],
                    'translations' => $valueTranslations,
                ]);
            } elseif ($property['property']['valueType'] === 'int') {
                if (null === $property['valueInt']) {
                    continue;
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['valueInt'],
                ]);
            } elseif ($property['property']['valueType'] === 'float') {
                if (null === $property['valueFloat']) {
                    continue;
                }

                $values[] = Value::fromArray([
                    'value' => (string) $property['valueFloat'],
                ]);
            } elseif ($property['property']['valueType'] === 'file') {
                $this->logger->notice('file properties are not supported', ['variation', $mainVariation['id']]);

                continue;
            }

            $result[] = Property::fromArray([
                'name' => $backendName,
                'values' => $values,
                'translations' => $translations,
            ]);
        }

        return $result;
    }
@param array $mainVariation

@return Property[]