/*
 * 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 com.aliyuncs.dt_oc_info.transform.v20220829;

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

import com.aliyuncs.dt_oc_info.model.v20220829.GetOcTaxClassAResponse;
import com.aliyuncs.dt_oc_info.model.v20220829.GetOcTaxClassAResponse.DataItem;
import com.aliyuncs.transform.UnmarshallerContext;


public class GetOcTaxClassAResponseUnmarshaller {

	public static GetOcTaxClassAResponse unmarshall(GetOcTaxClassAResponse getOcTaxClassAResponse, UnmarshallerContext _ctx) {
		
		getOcTaxClassAResponse.setRequestId(_ctx.stringValue("GetOcTaxClassAResponse.RequestId"));
		getOcTaxClassAResponse.setCode(_ctx.stringValue("GetOcTaxClassAResponse.Code"));
		getOcTaxClassAResponse.setSuccess(_ctx.booleanValue("GetOcTaxClassAResponse.Success"));
		getOcTaxClassAResponse.setMessage(_ctx.stringValue("GetOcTaxClassAResponse.Message"));
		getOcTaxClassAResponse.setTotalNum(_ctx.integerValue("GetOcTaxClassAResponse.TotalNum"));
		getOcTaxClassAResponse.setPageIndex(_ctx.integerValue("GetOcTaxClassAResponse.PageIndex"));
		getOcTaxClassAResponse.setPageNum(_ctx.integerValue("GetOcTaxClassAResponse.PageNum"));

		List<DataItem> data = new ArrayList<DataItem>();
		for (int i = 0; i < _ctx.lengthValue("GetOcTaxClassAResponse.Data.Length"); i++) {
			DataItem dataItem = new DataItem();
			dataItem.setEntName(_ctx.stringValue("GetOcTaxClassAResponse.Data["+ i +"].EntName"));
			dataItem.setTaxpayerNum(_ctx.stringValue("GetOcTaxClassAResponse.Data["+ i +"].TaxpayerNum"));
			dataItem.setYear(_ctx.stringValue("GetOcTaxClassAResponse.Data["+ i +"].Year"));
			dataItem.setTaxLevel(_ctx.stringValue("GetOcTaxClassAResponse.Data["+ i +"].TaxLevel"));

			data.add(dataItem);
		}
		getOcTaxClassAResponse.setData(data);
	 
	 	return getOcTaxClassAResponse;
	}
}