complex-barcode/mailmark-2d-codetext.js

const { MwMailmark2DCodetext } = require("../_mwbridge/_mw-bridge.js");
const IComplexCodetext = require("./i-complex-codetext");
const {EncodeTypes} = require("../generation");

/**
 * Class for encoding and decoding the text embedded in the Royal Mail 2D Mailmark code.
 */
class Mailmark2DCodetext extends IComplexCodetext
{
    static _fromMwObject(mwObject)
    {
        let jsClass = new Mailmark2DCodetext();
        jsClass.setJavaClass(mwObject);
        return jsClass;
    }

    /**
     * Identifies the UPU Country ID.Max length: 4 characters.
     * @return Country ID
     */
    getUPUCountryID()
    {
        return this.getJavaClass().getUPUCountryIDSync();
    }

    /**
     * Identifies the UPU Country ID.Max length: 4 characters.
     * @param value Country ID
     */
    setUPUCountryID(value)
    {
        this.getJavaClass().setUPUCountryIDSync(value);
    }

    /**
     * Identifies the Royal Mail Mailmark barcode payload for each product type.<br>
     * Valid Values:<br>
     * <br>
     * '0' - Domestic Sorted &amp; Unsorted<br>
     * 'A' - Online Postage<br>
     * 'B' - Franking<br>
     * 'C' - Consolidation
     *
     * @return Information type ID
     */
    getInformationTypeID()
    {
        return this.getJavaClass().getInformationTypeIDSync();
    }

    /**
     * Identifies the Royal Mail Mailmark barcode payload for each product type.<br>
     * Valid Values:<br>
     * <br>
     * '0' - Domestic Sorted &amp; Unsorted<br>
     * 'A' - Online Postage<br>
     * 'B' - Franking<br>
     * 'C' - Consolidation
     *
     * @param value Information type ID
     */
    setInformationTypeID(value)
    {
        this.getJavaClass().setInformationTypeIDSync(value);
    }


    /**
     * Identifies the  barcode version as relevant to each Information Type ID.<br>
     * Valid Values:<br>
     * <br>
     * Currently '1'.<br>
     * '0' &amp; '2' to '9' and 'A' to 'Z' spare reserved for potential future use.
     *
     * @return Version ID
     */
    getVersionID()
    {
        return this.getJavaClass().getVersionIDSync();
    }

    /**
     * Identifies the  barcode version as relevant to each Information Type ID.<br>
     * Valid Values:<br>
     * <br>
     * Currently '1'.<br>
     * '0' &amp; '2' to '9' and 'A' to 'Z' spare reserved for potential future use.
     *
     * @param value Version ID
     */
    setVersionID(value)
    {
        this.getJavaClass().setVersionIDSync(value);
    }

    /**
     * Identifies the class of the item.<br>
     * <br>
     * Valid Values:<br>
     * '1' - 1C (Retail)<br>
     * '2' - 2C (Retail)<br>
     * '3' - Economy (Retail)<br>
     * '5' - Deffered (Retail)<br>
     * '8' - Premium (Network Access)<br>
     * '9' - Standard (Network Access)
     *
     * @return class of the item
     */
    getClass_()
    {
        return this.getJavaClass().getClass_Sync();
    }

    /**
     * Identifies the class of the item.<br>
     * <br>
     * Valid Values:<br>
     * '1' - 1C (Retail)<br>
     * '2' - 2C (Retail)<br>
     * '3' - Economy (Retail)<br>
     * '5' - Deffered (Retail)<br>
     * '8' - Premium (Network Access)<br>
     * '9' - Standard (Network Access)
     *
     * @param value  class of the item
     */
    setClass_(value)
    {
        this.getJavaClass().setclassSync(value);
    }

    /**
     * Identifies the unique group of customers involved in the mailing.<br>
     * Max value: 9999999.
     *
     * @return Supply chain ID
     */
    getSupplyChainID()
    {
        return this.getJavaClass().getSupplyChainIDSync();
    }

    /**
     * Identifies the unique group of customers involved in the mailing.<br>
     * Max value: 9999999.
     *
     * @param value  Supply chain ID
     */
    setSupplyChainID(value)
    {
        this.getJavaClass().setSupplyChainIDSync(value);
    }

    /**
     * Identifies the unique item within the Supply Chain ID.<br>
     * Every Mailmark barcode is required to carry an ID<br>
     * so it can be uniquely identified for at least 90 days.<br>
     * Max value: 99999999.
     *
     * @return item within the Supply Chain ID
     */
    getItemID()
    {
        return this.getJavaClass().getItemIDSync();
    }

    /**
     * Identifies the unique item within the Supply Chain ID.<br>
     * Every Mailmark barcode is required to carry an ID<br>
     * so it can be uniquely identified for at least 90 days.<br>
     * Max value: 99999999.
     *
     * @param value item within the Supply Chain ID
     */
    setItemID(value)
    {
        this.getJavaClass().setItemIDSync(value);
    }

    /**
     * Contains the Postcode of the Delivery Address with DPS<br>
     * If inland the Postcode/DP contains the following number of characters.<br>
     * Area (1 or 2 characters) District(1 or 2 characters)<br>
     * Sector(1 character) Unit(2 characters) DPS (2 characters).<br>
     * The Postcode and DPS must comply with a valid PAF® format.
     *
     * @return the Postcode of the Delivery Address with DPS
     */
    getDestinationPostCodeAndDPS()
    {
        return this.getJavaClass().getDestinationPostCodeAndDPSSync();
    }

    /**
     * Contains the Postcode of the Delivery Address with DPS<br>
     * If inland the Postcode/DP contains the following number of characters.<br>
     * Area (1 or 2 characters) District(1 or 2 characters)<br>
     * Sector(1 character) Unit(2 characters) DPS (2 characters).<br>
     * The Postcode and DPS must comply with a valid PAF® format.
     *
     * @param value  the Postcode of the Delivery Address with DPS
     */
    setDestinationPostCodeAndDPS(value)
    {
        this.getJavaClass().setDestinationPostCodeAndDPSSync(value);
    }

    /**
     * Flag which indicates what level of Return to Sender service is being requested.
     *
     * @return RTS Flag
     */
    getRTSFlag()
    {
        return this.getJavaClass().getRTSFlagSync();
    }

    /**
     * Flag which indicates what level of Return to Sender service is being requested.
     *
     * @return RTS Flag
     */
    setRTSFlag(value)
    {
        this.getJavaClass().setRTSFlagSync(value);
    }

    /**
     * Contains the Return to Sender Post Code but no DPS.<br>
     * The PC(without DPS) must comply with a PAF® format.
     *
     * @return Return to Sender Post Code but no DPS
     */
    getReturnToSenderPostCode()
    {
        return this.getJavaClass().getReturnToSenderPostCodeSync();
    }

    /**
     * Contains the Return to Sender Post Code but no DPS.<br>
     * The PC(without DPS) must comply with a PAF® format.
     *
     * @param value  Return to Sender Post Code but no DPS
     */
    setReturnToSenderPostCode(value)
    {
        this.getJavaClass().setReturnToSenderPostCodeSync(value);
    }

    /**
     * Optional space for use by customer.<br>
     * <br>
     * Max length by Type:<br>
     * Type 7: 6 characters<br>
     * Type 9: 45 characters<br>
     * Type 29: 25 characters
     *
     * @return Customer content
     */
    getCustomerContent()
    {
        return this.getJavaClass().getCustomerContentSync();
    }

    /**
     * Optional space for use by customer.<br>
     * <br>
     * Max length by Type:<br>
     * Type 7: 6 characters<br>
     * Type 9: 45 characters<br>
     * Type 29: 25 characters
     *
     * @param value  Customer content
     */
    setCustomerContent(value)
    {
        this.getJavaClass().setCustomerContentSync(value);
    }

    /**
     * Encode mode of Datamatrix barcode.<br>
     * Default value: DataMatrixEncodeMode.C40.
     *
     * @return Encode mode of Datamatrix barcode.
     */
    getCustomerContentEncodeMode()
    {
        return this.getJavaClass().getCustomerContentEncodeModeSync();
    }

    /**
     * Encode mode of Datamatrix barcode.<br>
     * Default value: DataMatrixEncodeMode.C40.
     *
     * @param value  Encode mode of Datamatrix barcode.
     */
    setCustomerContentEncodeMode(value)
    {
        this.getJavaClass().setCustomerContentEncodeModeSync(value);
    }

    /**
     * 2D Mailmark Type defines size of Data Matrix barcode.
     *
     * @return Size of Data Matrix barcode
     */
    getDataMatrixType()
    {
        return this.getJavaClass().getDataMatrixTypeSync();
    }

    /**
     * 2D Mailmark Type defines size of Data Matrix barcode.
     *
     * @param value  Size of Data Matrix barcode
     */
    setDataMatrixType(value)
    {
        this.getJavaClass().setDataMatrixTypeSync(value);
    }

    /**
     * Create default instance of Mailmark2DCodetext class.
     */
    constructor()
    {
        super(new MwMailmark2DCodetext());
        this._initializeWrapperMembers();
    }

    _initializeWrapperMembers()
    {}

    /**
     * Construct codetext from Mailmark data.
     * @return Constructed codetext
     */
    getConstructedCodetext()
    {

        return this.getJavaClass().getConstructedCodetextSync();
    }

    /**
     * Initializes Mailmark data from constructed codetext.
     * @param constructedCodetext Constructed codetext.
     */
    initFromString(constructedCodetext)
    {
        this.getJavaClass().initFromStringSync(constructedCodetext);
    }

    /**
     * Gets barcode type.
     * @return Barcode type.
     */
    getBarcodeType()  {
        return EncodeTypes.DATA_MATRIX;
    }
}

module.exports = Mailmark2DCodetext