<commit_before>module VTEX
  class ProductBuilder
    class << self

      # Do not change the order of fields
      def build_product(product, client)
        {
          'vtex:AdWordsRemarketingCode' => nil,
          'vtex:BrandId'                => client.find_or_create_brand(product['brand']) || 1,
          'vtex:CategoryId'             => client.find_or_create_category(product['taxons']) || 1000000,
          'vtex:DepartmentId'           => 1000000,
          'vtex:Description'            => product['description'],
          'vtex:DescriptionShort'       => nil,
          'vtex:Id'                     => clear_id(product['id']), # I think this should be populated by vtex
          'vtex:IsActive'               => nil,
          'vtex:IsVisible'              => true,
          'vtex:KeyWords'               => product['meta_keywords'],
          'vtex:LinkId'                 => product['permalink'],
          'vtex:ListStoreId'            => nil,
          'vtex:LomadeeCampaignCode'    => nil,
          'vtex:MetaTagDescription'     => product['meta_description'],
          'vtex:Name'                   => product['name'],
          'vtex:RefId'                  => product['id'],
          'vtex:ReleaseDate'            => product['available_on'],
          'vtex:ShowWithoutStock'       => nil,
          'vtex:SupplierId'             => nil,
          'vtex:TaxCode'                => nil,
          'vtex:Title'                  => nil
         }
      end

      #Do not change the order of fields
      def build_skus(product)
        skus = (product['variants'] || []).map do |item|
          hash = {
            'vtex:CommercialConditionId' => nil,
            'vtex:CostPrice'             => item['cost_price'],
            'vtex:CubicWeight'           => 0.02,
            'vtex:DateUpdated'           => nil,
            'vtex:EstimatedDateArrival'  => nil,
            'vtex:Height'                => 0.02,
            'vtex:Id'                    => (item.has_key?('id') ? clear_id(item['id']) : nil), # I think this should be populated by vtex
            'vtex:InternalNote'          => nil,
            'vtex:IsActive'              => true,
            'vtex:IsAvaiable'            => nil,
            'vtex:IsKit'                 => false,
            'vtex:Length'                => 0.02,
            'vtex:ListPrice'             => item['price'],
            'vtex:ManufacturerCode'      => nil,
            'vtex:MeasurementUnit'       => nil,
            'vtex:ModalId'               => (item.has_key?('options') && item['options']['size']=='S' ? 1 : 2),
            'vtex:ModalType'             => nil,
            'vtex:Name'                  => product['name'],
            'vtex:Price'                 => item['price'],
            'vtex:ProductId'             => clear_id(product['id']),
            'vtex:ProductName'           => product['name'],
            'vtex:RealHeight'            => nil,
            'vtex:RealLength'            => nil,
            'vtex:RealWeightKg'          => nil,
            'vtex:RealWidth'             => nil,
            'vtex:RefId'                 => (item.has_key?('id') ? item['id'] : product['id']),
            'vtex:RewardValue'           => nil,
            'vtex:StockKeepingUnitEans'  => nil,
            'vtex:UnitMultiplier'        => nil,
            'vtex:WeightKg'              => 0.02,
            'vtex:Width'                 => 0.02
          }

          if item['abacos'] && item['abacos']['codigo_barras']
            hash['vtex:StockKeepingUnitEans'] = {
              'vtex:StockKeepingUnitEanDTO' => {
                'vtex:Ean' => item['abacos']['codigo_barras']
              }
            }
          end

          hash
        end

        master_product = {
          'vtex:CommercialConditionId' => nil,
          'vtex:CostPrice'             => product['cost_price'],
          'vtex:CubicWeight'           => product['weight'],
          'vtex:DateUpdated'           => nil,
          'vtex:EstimatedDateArrival'  => nil,
          'vtex:Height'                => product['height'],
          'vtex:Id'                    => (product.has_key?('id') ? product['id'] : nil), # I think this should be populated by vtex
          'vtex:InternalNote'          => nil,
          'vtex:IsActive'              => true,
          'vtex:IsAvaiable'            => nil,
          'vtex:IsKit'                 => false,
          'vtex:Length'                => product['height'],
          'vtex:ListPrice'             => product['price'],
          'vtex:ManufacturerCode'      => nil,
          'vtex:MeasurementUnit'       => nil,
          'vtex:ModalId'               => 1, #TODO figure out how to calculate the correct size for this product
          'vtex:ModalType'             => nil,
          'vtex:Name'                  => product['name'],
          'vtex:Price'                 => product['price'],
          'vtex:ProductId'             => product['id'],
          'vtex:ProductName'           => product['name'],
          'vtex:RealHeight'            => nil,
          'vtex:RealLength'            => nil,
          'vtex:RealWeightKg'          => nil,<commit_msg>removes vtexId and returns clear_id to another productId value<commit_after>module VTEX
  class ProductBuilder
    class << self

      # Do not change the order of fields
      def build_product(product, client)
        {
          'vtex:AdWordsRemarketingCode' => nil,
          'vtex:BrandId'                => client.find_or_create_brand(product['brand']) || 1,
          'vtex:CategoryId'             => client.find_or_create_category(product['taxons']) || 1000000,
          'vtex:DepartmentId'           => 1000000,
          'vtex:Description'            => product['description'],
          'vtex:DescriptionShort'       => nil,
          'vtex:IsActive'               => nil,
          'vtex:IsVisible'              => true,
          'vtex:KeyWords'               => product['meta_keywords'],
          'vtex:LinkId'                 => product['permalink'],
          'vtex:ListStoreId'            => nil,
          'vtex:LomadeeCampaignCode'    => nil,
          'vtex:MetaTagDescription'     => product['meta_description'],
          'vtex:Name'                   => product['name'],
          'vtex:RefId'                  => product['id'],
          'vtex:ReleaseDate'            => product['available_on'],
          'vtex:ShowWithoutStock'       => nil,
          'vtex:SupplierId'             => nil,
          'vtex:TaxCode'                => nil,
          'vtex:Title'                  => nil
         }
      end

      #Do not change the order of fields
      def build_skus(product)
        skus = (product['variants'] || []).map do |item|
          hash = {
            'vtex:CommercialConditionId' => nil,
            'vtex:CostPrice'             => item['cost_price'],
            'vtex:CubicWeight'           => 0.02,
            'vtex:DateUpdated'           => nil,
            'vtex:EstimatedDateArrival'  => nil,
            'vtex:Height'                => 0.02,
            'vtex:InternalNote'          => nil,
            'vtex:IsActive'              => true,
            'vtex:IsAvaiable'            => nil,
            'vtex:IsKit'                 => false,
            'vtex:Length'                => 0.02,
            'vtex:ListPrice'             => item['price'],
            'vtex:ManufacturerCode'      => nil,
            'vtex:MeasurementUnit'       => nil,
            'vtex:ModalId'               => (item.has_key?('options') && item['options']['size']=='S' ? 1 : 2),
            'vtex:ModalType'             => nil,
            'vtex:Name'                  => product['name'],
            'vtex:Price'                 => item['price'],
            'vtex:ProductId'             => clear_id(product['id']),
            'vtex:ProductName'           => product['name'],
            'vtex:RealHeight'            => nil,
            'vtex:RealLength'            => nil,
            'vtex:RealWeightKg'          => nil,
            'vtex:RealWidth'             => nil,
            'vtex:RefId'                 => (item.has_key?('id') ? item['id'] : product['id']),
            'vtex:RewardValue'           => nil,
            'vtex:StockKeepingUnitEans'  => nil,
            'vtex:UnitMultiplier'        => nil,
            'vtex:WeightKg'              => 0.02,
            'vtex:Width'                 => 0.02
          }

          if item['abacos'] && item['abacos']['codigo_barras']
            hash['vtex:StockKeepingUnitEans'] = {
              'vtex:StockKeepingUnitEanDTO' => {
                'vtex:Ean' => item['abacos']['codigo_barras']
              }
            }
          end

          hash
        end

        master_product = {
          'vtex:CommercialConditionId' => nil,
          'vtex:CostPrice'             => product['cost_price'],
          'vtex:CubicWeight'           => product['weight'],
          'vtex:DateUpdated'           => nil,
          'vtex:EstimatedDateArrival'  => nil,
          'vtex:Height'                => product['height'],
          'vtex:InternalNote'          => nil,
          'vtex:IsActive'              => true,
          'vtex:IsAvaiable'            => nil,
          'vtex:IsKit'                 => false,
          'vtex:Length'                => product['height'],
          'vtex:ListPrice'             => product['price'],
          'vtex:ManufacturerCode'      => nil,
          'vtex:MeasurementUnit'       => nil,
          'vtex:ModalId'               => 1, #TODO figure out how to calculate the correct size for this product
          'vtex:ModalType'             => nil,
          'vtex:Name'                  => product['name'],
          'vtex:Price'                 => product['price'],
          'vtex:ProductId'             => clear_id(product['id']),
          'vtex:ProductName'           => product['name'],
          'vtex:RealHeight'            => nil,
          'vtex:RealLength'            => nil,
          'vtex:RealWeightKg'          => nil,
{'fraction_non_alphanumeric': 0.1385518201710762, 'fraction_numerical': 0.006564551422319475, 'mean_word_length': 1.3141542002301496, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 156, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '213008', 'n_tokens_mistral': 2917, 'n_tokens_neox': 2800, 'n_words': 457}