package com.yidianling.ydl_pay.pay.redpacket

import android.os.Parcel
import android.os.Parcelable
import com.yidianling.ydl_pay.pay.PayParams

/**
 * @author yuanWai
 * @描述:
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2018/10/25
 */
data class RedPacketPayBean(val payParams: PayParams,
                            val data: ArrayList<RedPacketBean>): Parcelable {
    constructor(parcel: Parcel) : this(
            parcel.readParcelable(PayParams::class.java.classLoader),
            parcel.createTypedArrayList(RedPacketBean.CREATOR)) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeParcelable(payParams, flags)
        parcel.writeTypedList(data)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<RedPacketPayBean> {
        override fun createFromParcel(parcel: Parcel): RedPacketPayBean {
            return RedPacketPayBean(parcel)
        }

        override fun newArray(size: Int): Array<RedPacketPayBean?> {
            return arrayOfNulls(size)
        }
    }
}