package com.mns.returns.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ReturnChannelResponse {

    @JsonProperty("OrderHeaderKey")
    private String orderHeaderKey;
    @JsonProperty("OrderNumber")
    private String orderNumber;
    @JsonProperty("OrderChannels")
    private List<OrderChannel> orderChannels = new ArrayList<OrderChannel>();
    @JsonProperty("MnSReturnAddress")
    private Boolean mnsReturnAddress;
    @JsonProperty("OrderItemList")
    private List<OrderItem> orderItemList = new ArrayList<OrderItem>();

}


package com.mns.returns.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OrderItem {
    @JsonProperty("UpcVariant")
    private String upcVariant;
    @JsonProperty("Sku")
    private String sku;
    @JsonProperty("ShipNode")
    private String shipNode;
    @JsonProperty("ProductType")
    private String productType;
    @JsonProperty("salesOrderIndicator")
    private String salesOrderIndicator;
    @JsonProperty("levelOfService")
    private String levelOfService;
    @JsonProperty("ItemDetails")
    private ItemDetails itemDetails;
    @JsonProperty("LineItemChannels")
    private List<LineItemChannel> lineItemChannels = new ArrayList<>();

}


package com.mns.returns.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.mns.returns.dto.address.ChannelAddress;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LineItemChannel {

    @JsonProperty("ChannelType")
    private String channelType;
    @JsonProperty("SubChannelTypes")
    private List<SubChannelType> subChannelTypes = new ArrayList<>();
    @JsonProperty("Address")
    private ChannelAddress address;
}


package com.mns.returns.dto.address;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document("channel-address")
public class ChannelAddress {

    @JsonProperty("channelID")
    private String channelID;
    @JsonProperty("address1")
    private String address1;
    @JsonProperty("address2")
    private String address2;
    @JsonProperty("address3")
    private String address3;
    @JsonProperty("city")
    private String city;
    @JsonProperty("country")
    private String country;
    @JsonProperty("county")
    private String county;
    @JsonProperty("postalCode")
    private String postalCode;
    @JsonProperty("contactName")
    private String contactName;

    @JsonProperty("contactPhoneNo")
    private String contactPhoneNo;

    @JsonProperty("contactEmailId")
    private String contactEmailId;

    @JsonProperty("clientId")
    private String clientId;
    @JsonProperty("childClientId")
    private String childClientId;
    @JsonProperty("dsvReturnAddress")
    private Boolean dsvReturnAddress;
}


package com.mns.returns.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.mns.returns.dto.address.ChannelAddress;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OrderChannel {

    @JsonProperty("ChannelType")
    private String channelType;
    @JsonProperty("SubChannelTypes")
    private List<SubChannelType> subChannelTypes = new ArrayList<SubChannelType>();
    @JsonProperty("Address")
    private ChannelAddress address;
}



Specifically tell me...How to update the java code and strictly provide this implememntation of createmymethod(ReturnChannelResponse response) implementation based on below logic

 In case of  childClientId is there and as value is 0.....add "returnShipNode":8222 in api response
if childClientId is not there or not 0 then see postalcode.... starting with xx  then it will stamped "returnShipNode":8222 in api reponse...otherwise it will not be stamped
here is a sample with new property to be added every addesss where condition satisfied..... "returnShipNode": "8222" in  ChannelAddress class which are referenced in OrderItemList and OrderChannel.....set for both places based on the condition provided 
"Address": {
        "channelID": "CH24",
        "address1": "Unit1 Boughton Industrial Estate",
        "address2": "Clipper Logistics - Ollerton",
        "address3": "",
        "city": "Newark",
        "country": "GB",
        "county": "",
        "postalCode": "NG22 9LD",
        "contactName": "M&S National Returns Centre",
        "contactPhoneNo": null,
        "contactEmailId": null,
        "clientId": "168",
        "childClientId": "0",
        "dsvReturnAddress": false,
        "returnShipNode": "8222"
      }
	  
	  Only tell me How to update the java code and strictly provide this implememntation of createmymethod(ReturnChannelResponse response) implementation based on below logic