/*
 * Copyright 2008-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.broadleafcommerce.admin.web.rulebuilder.service;

import org.broadleafcommerce.common.presentation.client.SupportedFieldType;
import org.broadleafcommerce.openadmin.web.rulebuilder.dto.FieldData;
import org.broadleafcommerce.openadmin.web.rulebuilder.service.AbstractRuleBuilderFieldService;
import org.springframework.stereotype.Service;

/**
 * An implementation of a RuleBuilderFieldService
 * that constructs metadata necessary
 * to build the supported fields for a Sku entity
 *
 * @author Priyesh Patel
 */
@Service("blSkuFieldService")
public class SkuFieldServiceImpl  extends AbstractRuleBuilderFieldService {


    {
        fields.add(new FieldData.Builder()
                .label("Sku - Name")
                .name("name")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());
        fields.add(new FieldData.Builder()
                .label("Sku - Description")
                .name("description")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());
        fields.add(new FieldData.Builder()
                .label("Sku - Long Description")
                .name("longDescription")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());

        fields.add(new FieldData.Builder()
                .label("Sku - Sale Price")
                .name("salePrice")
                .operators("blcOperators_Numeric")
                .options("[]")
                .type(SupportedFieldType.MONEY)
                .build());
        fields.add(new FieldData.Builder()
                .label("Sku - Retail Price")
                .name("retailPrice")
                .operators("blcOperators_Numeric")
                .options("[]")
                .type(SupportedFieldType.MONEY)
                .build());
        fields.add(new FieldData.Builder()
                .label("Product - URL")
                .name("product.url")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());
        fields.add(new FieldData.Builder()
                .label("Product - Is Featured Product")
                .name("product.isFeaturedProduct")
                .operators("blcOperators_Boolean")
                .options("[]")
                .type(SupportedFieldType.BOOLEAN)
                .build());
        fields.add(new FieldData.Builder()
                .label("Product - Manufacturer")
                .name("product.manufacturer")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());
        fields.add(new FieldData.Builder()
                .label("Product - Model")
                .name("product.model")
                .operators("blcOperators_Text")
                .options("[]")
                .type(SupportedFieldType.STRING)
                .build());
        fields.add(new FieldData.Builder()
                .label("Sku - Fulfillment Type")
                .name("fulfillmentType")
                .operators("blcOperators_Enumeration")
                .options("blcOptions_FulfillmentType")
                .type(SupportedFieldType.BROADLEAF_ENUMERATION)
                .build());
        fields.add(new FieldData.Builder()
                .label("Sku - Inventory Type")
                .name("inventoryType")
                .operators("blcOperators_Enumeration")
                .options("blcOptions_InventoryType")
                .type(SupportedFieldType.BROADLEAF_ENUMERATION)
                .build());

    }

    @Override
    public String getName() {
        return "SKU_FIELDS";
    }

}

@@ -2684,32 +2684,969 @@
 dData.Builder()%0A
+                .label(%22Sku - Fulfillment Type%22)%0A                .name(%22fulfillmentType%22)%0A                .operators(%22blcOperators_Enumeration%22)%0A                .options(%22blcOptions_FulfillmentType%22)%0A                .type(SupportedFieldType.BROADLEAF_ENUMERATION)%0A                .build());%0A        fields.add(new FieldData.Builder()%0A                .label(%22Sku - Inventory Type%22)%0A                .name(%22inventoryType%22)%0A                .operators(%22blcOperators_Enumeration%22)%0A                .options(%22blcOptions_InventoryType%22)%0A                .type(SupportedFieldType.BROADLEAF_ENUMERATION)%0A                .build());%0A        fields.add(new FieldData.Builder()%0A                .label(%22Sku - taxable%22)%0A                .name(%22taxable%22)%0A                .operators(%22blcOperators_Boolean%22)%0A                .options(%22%5B%5D%22)%0A                .type(SupportedFieldType.BOOLEAN)%0A                .build());%0A        fields.add(new FieldData.Builder()%0A
                 
@@ -4746,669 +4746,8 @@
 ));%0A
-        fields.add(new FieldData.Builder()%0A                .label(%22Sku - Fulfillment Type%22)%0A                .name(%22fulfillmentType%22)%0A                .operators(%22blcOperators_Enumeration%22)%0A                .options(%22blcOptions_FulfillmentType%22)%0A                .type(SupportedFieldType.BROADLEAF_ENUMERATION)%0A                .build());%0A        fields.add(new FieldData.Builder()%0A                .label(%22Sku - Inventory Type%22)%0A                .name(%22inventoryType%22)%0A                .operators(%22blcOperators_Enumeration%22)%0A                .options(%22blcOptions_InventoryType%22)%0A                .type(SupportedFieldType.BROADLEAF_ENUMERATION)%0A                .build());
 %0A%0A  

add taxable field in the builder