UomRelationVO.java

/*
 * Copyright 2005-2025 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.openwms.wms.inventory.api;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openwms.core.units.api.Measurable;

import java.beans.ConstructorProperties;
import java.util.Map;

/**
 * A UomRelationVO defines and identifies an UOM for a given Product with an unique label. It is used to define the same Product in
 * various UOM, each one identified with a different label.
 *
 * @author Heiko Scherrer
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class UomRelationVO {

    /** The persistent unique key. */
    @JsonProperty("pKey")
    public String pKey;
    @JsonProperty("description")
    public String description;
    /** The product this UOMRelation belongs to. */
    @JsonBackReference
    public ProductVO product;
    /** The unique label of this UOMRelation mapping. */
    @JsonProperty("label")
    private String label;
    /** The internal representation code of the UOMRelation mapping. */
    @JsonProperty("code")
    private String code;
    /** The assigned quantity of this UOMRelation mapping. */
    @JsonProperty("quantity")
    private Measurable quantity;
    /** The defined dimension of the UomRelation. */
    @JsonProperty("dimension")
    private DimensionVO dimension;
    /** Arbitrary detail information on this product unit, might by populated with ERP information. */
    @JsonProperty("details")
    private Map<String, String> details;

    /* For the Mapper */
    public UomRelationVO() {
    }

    @ConstructorProperties({"label", "quantity", "dimension", "details"})
    public UomRelationVO(String label, Measurable quantity, DimensionVO dimension, Map<String, String> details) {
        this.label = label;
        this.quantity = quantity;
        this.dimension = dimension;
        this.details = details;
    }

    public String getpKey() {
        return pKey;
    }

    public void setpKey(String pKey) {
        this.pKey = pKey;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ProductVO getProduct() {
        return product;
    }

    public void setProduct(ProductVO product) {
        this.product = product;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Measurable getQuantity() {
        return quantity;
    }

    public void setQuantity(Measurable quantity) {
        this.quantity = quantity;
    }

    public DimensionVO getDimension() {
        return dimension;
    }

    public void setDimension(DimensionVO dimension) {
        this.dimension = dimension;
    }

    public Map<String, String> getDetails() {
        return details;
    }

    public void setDetails(Map<String, String> details) {
        this.details = details;
    }
}