/**
  * Get default configurable.
  *
  * @param Group             $group
  * @param string            $sku
  * @param int               $attributeSetId
  * @param array             $products
  * @param array             $magentoAttributes
  * @param array             $magentoAttributesOptions
  * @param string            $locale
  * @param string            $website
  * @param string            $channel
  * @param MappingCollection $categoryMapping
  * @param MappingCollection $attributeMapping
  * @param boolean           $create
  * @param string            $pimGrouped
  * @param boolean           $urlKey
  * @param boolean           $skuFirst
  *
  * @return array
  *
  * @throws InvalidPriceMappingException
  */
 protected function getDefaultConfigurable(Group $group, $sku, $attributeSetId, $products, $magentoAttributes, $magentoAttributesOptions, $locale, $website, $channel, MappingCollection $categoryMapping, MappingCollection $attributeMapping, $create, $pimGrouped, $urlKey, $skuFirst)
 {
     $priceMapping = $this->priceMappingManager->getPriceMapping($group, $products, $attributeMapping);
     try {
         $this->priceMappingManager->validatePriceMapping($products, $priceMapping[self::PRICE_CHANGES], $priceMapping[self::BASE_PRICE], $attributeMapping);
     } catch (ComputedPriceNotMatchedException $e) {
         throw new InvalidPriceMappingException(sprintf('Price mapping cannot be automatically computed. This might be because an associated product has ' . 'an inconsistant price regarding the other products of the variant group. %s', $e->getMessage()));
     }
     $associatedSkus = $this->getProductsSkus($products);
     $defaultProduct = $products[0];
     $defaultProductValues = $this->productNormalizer->getValues($defaultProduct, $magentoAttributes, $magentoAttributesOptions, $locale, $channel, $categoryMapping, $attributeMapping, false, $pimGrouped, $urlKey, $skuFirst);
     $defaultProductValues[ProductNormalizer::VISIBILITY] = $this->visibility;
     $defaultProductValues[ProductNormalizer::URL_KEY] = $defaultProductValues[ProductNormalizer::URL_KEY] . '-conf-' . $group->getId();
     $configurableAttributes['configurable_attributes'] = [];
     $attributes = $group->getAttributes();
     foreach ($attributes as $attribute) {
         $magentoAttributeCode = strtolower($attributeMapping->getTarget($attribute->getCode()));
         $magentoAttributeId = $magentoAttributes[$magentoAttributeCode]['attribute_id'];
         $configurableAttributes['configurable_attributes'][] = $magentoAttributeId;
     }
     $defaultConfigurableValues = array_merge($defaultProductValues, $configurableAttributes, $priceMapping, [self::ASSOCIATED_SKUS => $associatedSkus]);
     $defaultConfigurableValues['websites'] = [$website];
     if ($create) {
         $defaultConfigurable = $this->getNewConfigurable($sku, $defaultConfigurableValues, $attributeSetId);
     } else {
         $defaultConfigurable = $this->getUpdatedConfigurable($sku, $defaultConfigurableValues);
     }
     return $defaultConfigurable;
 }
 /**
  * Get default configurable
  * @param Group             $group
  * @param string            $sku
  * @param int               $attributeSetId
  * @param array             $products
  * @param array             $magentoAttributes
  * @param array             $magentoAttributesOptions
  * @param string            $locale
  * @param string            $website
  * @param string            $channel
  * @param MappingCollection $categoryMapping
  * @param MappingCollection $attributeMapping
  * @param bool              $create
  *
  * @return array
  */
 protected function getDefaultConfigurable(Group $group, $sku, $attributeSetId, $products, $magentoAttributes, $magentoAttributesOptions, $locale, $website, $channel, MappingCollection $categoryMapping, MappingCollection $attributeMapping, $create)
 {
     $priceMapping = $this->priceMappingManager->getPriceMapping($group, $products, $attributeMapping);
     try {
         $this->priceMappingManager->validatePriceMapping($products, $priceMapping[self::PRICE_CHANGES], $priceMapping[self::BASE_PRICE], $attributeMapping);
     } catch (ComputedPriceNotMatchedException $e) {
         throw new InvalidPriceMappingException(sprintf('Price mapping cannot be automatically computed. This might be because an associated product has ' . 'an inconsistant price regarding the other products of the variant group. %s', $e->getMessage()));
     }
     $associatedSkus = $this->getProductsSkus($products);
     $defaultProduct = $products[0];
     $defaultProductValues = $this->productNormalizer->getValues($defaultProduct, $magentoAttributes, $magentoAttributesOptions, $locale, $channel, $categoryMapping, $attributeMapping, false);
     $defaultConfigurableValues = array_merge($defaultProductValues, $priceMapping, [self::ASSOCIATED_SKUS => $associatedSkus]);
     $defaultConfigurableValues['websites'] = [$website];
     if ($create) {
         $defaultConfigurable = $this->getNewConfigurable($sku, $defaultConfigurableValues, $attributeSetId);
     } else {
         $defaultConfigurable = $this->getUpdatedConfigurable($sku, $defaultConfigurableValues);
     }
     return $defaultConfigurable;
 }