Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.shopify.models;

import com.spice.profitmandi.dao.model.MediaPojo;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * Represents the Shopify ProductInput used for productCreate/productUpdate mutations.
 * This model mirrors Shopify's ProductInput schema.
 */
public class ProductInputModel {
    private String id; // optional, for updates
    private String title;
    private String bodyHtml;
    private String vendor;
    private String tags;
    private String productType;
    private String handle;
    private String status;
    private String templateSuffix;
    private String seoTitle;
    private String seoDescription;

    // Collections
    private List<String> collectionIds; // gid://shopify/Collection/xxxxxx

    // Options
    private List<Map<String, Object>> options; // e.g. [{ name: "Color", values: ["Red", "Blue"] }]

    // Variants
    private List<Map<String, Object>> variants; // e.g. [{ sku: "SKU123", price: "999", option1: "Red" }]

    // Images
    private List<MediaPojo> images;

    // Inventory (optional if managed externally)
    private Integer inventoryQuantity;
    private String inventoryPolicy;      // "DENY" or "CONTINUE"
    private String inventoryManagement;  // "SHOPIFY" or null
    private String locationGid;          // gid://shopify/Location/xxxxxx

    // Pricing
    private String price;
    private String compareAtPrice;
    private String costPerItem;

    // Visibility
    private Boolean published;
    private String publishedAt;

    public ProductInputModel() {}

    // --- Getters and Setters ---

    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }

    public String getBodyHtml() { return bodyHtml; }
    public void setBodyHtml(String bodyHtml) { this.bodyHtml = bodyHtml; }

    public String getVendor() { return vendor; }
    public void setVendor(String vendor) { this.vendor = vendor; }

    public String getTags() { return tags; }
    public void setTags(String tags) { this.tags = tags; }

    public String getProductType() { return productType; }
    public void setProductType(String productType) { this.productType = productType; }

    public String getHandle() { return handle; }
    public void setHandle(String handle) { this.handle = handle; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public String getTemplateSuffix() { return templateSuffix; }
    public void setTemplateSuffix(String templateSuffix) { this.templateSuffix = templateSuffix; }

    public String getSeoTitle() { return seoTitle; }
    public void setSeoTitle(String seoTitle) { this.seoTitle = seoTitle; }

    public String getSeoDescription() { return seoDescription; }
    public void setSeoDescription(String seoDescription) { this.seoDescription = seoDescription; }

    public List<String> getCollectionIds() { return collectionIds; }
    public void setCollectionIds(List<String> collectionIds) { this.collectionIds = collectionIds; }

    public List<Map<String, Object>> getOptions() { return options; }
    public void setOptions(List<Map<String, Object>> options) { this.options = options; }

    public List<Map<String, Object>> getVariants() { return variants; }
    public void setVariants(List<Map<String, Object>> variants) { this.variants = variants; }

    public List<MediaPojo> getImages() { return images; }
    public void setImages(List<MediaPojo> images) { this.images = images; }

    public Integer getInventoryQuantity() { return inventoryQuantity; }
    public void setInventoryQuantity(Integer inventoryQuantity) { this.inventoryQuantity = inventoryQuantity; }

    public String getInventoryPolicy() { return inventoryPolicy; }
    public void setInventoryPolicy(String inventoryPolicy) { this.inventoryPolicy = inventoryPolicy; }

    public String getInventoryManagement() { return inventoryManagement; }
    public void setInventoryManagement(String inventoryManagement) { this.inventoryManagement = inventoryManagement; }

    public String getLocationGid() { return locationGid; }
    public void setLocationGid(String locationGid) { this.locationGid = locationGid; }

    public String getPrice() { return price; }
    public void setPrice(String price) { this.price = price; }

    public String getCompareAtPrice() { return compareAtPrice; }
    public void setCompareAtPrice(String compareAtPrice) { this.compareAtPrice = compareAtPrice; }

    public String getCostPerItem() { return costPerItem; }
    public void setCostPerItem(String costPerItem) { this.costPerItem = costPerItem; }

    public Boolean getPublished() { return published; }
    public void setPublished(Boolean published) { this.published = published; }

    public String getPublishedAt() { return publishedAt; }
    public void setPublishedAt(String publishedAt) { this.publishedAt = publishedAt; }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof ProductInputModel)) return false;
        ProductInputModel that = (ProductInputModel) o;
        return Objects.equals(id, that.id) && Objects.equals(title, that.title) && Objects.equals(bodyHtml, that.bodyHtml) && Objects.equals(vendor, that.vendor) && Objects.equals(tags, that.tags) && Objects.equals(productType, that.productType) && Objects.equals(handle, that.handle) && Objects.equals(status, that.status) && Objects.equals(templateSuffix, that.templateSuffix) && Objects.equals(seoTitle, that.seoTitle) && Objects.equals(seoDescription, that.seoDescription) && Objects.equals(collectionIds, that.collectionIds) && Objects.equals(options, that.options) && Objects.equals(variants, that.variants) && Objects.equals(images, that.images) && Objects.equals(inventoryQuantity, that.inventoryQuantity) && Objects.equals(inventoryPolicy, that.inventoryPolicy) && Objects.equals(inventoryManagement, that.inventoryManagement) && Objects.equals(locationGid, that.locationGid) && Objects.equals(price, that.price) && Objects.equals(compareAtPrice, that.compareAtPrice) && Objects.equals(costPerItem, that.costPerItem) && Objects.equals(published, that.published) && Objects.equals(publishedAt, that.publishedAt);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, bodyHtml, vendor, tags, productType, handle, status, templateSuffix, seoTitle, seoDescription, collectionIds, options, variants, images, inventoryQuantity, inventoryPolicy, inventoryManagement, locationGid, price, compareAtPrice, costPerItem, published, publishedAt);
    }

    @Override
    public String toString() {
        return "ProductInputModel{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", bodyHtml='" + bodyHtml + '\'' +
                ", vendor='" + vendor + '\'' +
                ", tags='" + tags + '\'' +
                ", productType='" + productType + '\'' +
                ", handle='" + handle + '\'' +
                ", status='" + status + '\'' +
                ", templateSuffix='" + templateSuffix + '\'' +
                ", seoTitle='" + seoTitle + '\'' +
                ", seoDescription='" + seoDescription + '\'' +
                ", collectionIds=" + collectionIds +
                ", options=" + options +
                ", variants=" + variants +
                ", images=" + images +
                ", inventoryQuantity=" + inventoryQuantity +
                ", inventoryPolicy='" + inventoryPolicy + '\'' +
                ", inventoryManagement='" + inventoryManagement + '\'' +
                ", locationGid='" + locationGid + '\'' +
                ", price='" + price + '\'' +
                ", compareAtPrice='" + compareAtPrice + '\'' +
                ", costPerItem='" + costPerItem + '\'' +
                ", published=" + published +
                ", publishedAt='" + publishedAt + '\'' +
                '}';
    }
}