All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.discountcodes.DiscountCodeDraft Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.discountcodes;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.annotations.FactoryMethod;
import io.sphere.sdk.annotations.IgnoreInQueryModel;
import io.sphere.sdk.annotations.ResourceDraftValue;
import io.sphere.sdk.cartdiscounts.CartDiscount;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.types.CustomFieldsDraft;

import javax.annotation.Nullable;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;

/**
 * @see DiscountCodeDraftBuilder
 * @see DiscountCodeDraftDsl
 */
@JsonDeserialize(as = DiscountCodeDraftDsl.class)
@ResourceDraftValue(
        abstractBuilderClass = true,
        abstractResourceDraftValueClass = true,
        factoryMethods = {@FactoryMethod(parameterNames = {"code", "cartDiscounts"})})
public interface DiscountCodeDraft {
    @Nullable
    LocalizedString getName();

    @Nullable
    LocalizedString getDescription();

    String getCode();

    List> getCartDiscounts();

    @Nullable
    String getCartPredicate();

    @JsonProperty("isActive")
    Boolean isActive();

    @Nullable
    List getGroups();

    @Nullable
    @IgnoreInQueryModel
    ZonedDateTime getValidFrom();

    @Nullable
    @IgnoreInQueryModel
    ZonedDateTime getValidUntil();

    @Nullable
    Long getMaxApplications();

    @Nullable
    Long getMaxApplicationsPerCustomer();

    @Nullable
    CustomFieldsDraft getCustom();

    static DiscountCodeDraftDsl of(final String code, final Referenceable cartDiscount) {
        return DiscountCodeDraft.of(code, Collections.singletonList(cartDiscount.toReference()));
    }

    static DiscountCodeDraftDsl of(final String code, final List> cartDiscounts) {
        return DiscountCodeDraftDsl.of(code, cartDiscounts);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy