package com.gh.gamecenter.entity

import android.os.Parcel
import android.os.Parcelable

/**
 * Created by khy on 20/06/17.
 */

class GameDetailContact : Parcelable {

    var service: GameDetailService? = null

    var player: GameDetailPlayer? = null

    override fun describeContents(): Int {
        return 0
    }

    override fun writeToParcel(dest: Parcel, flags: Int) {
        dest.writeParcelable(this.service, flags)
        dest.writeParcelable(this.player, flags)
    }

    constructor() {}

    protected constructor(`in`: Parcel) {
        this.service = `in`.readParcelable<GameDetailService>(GameDetailService::class.java.classLoader)
        this.player = `in`.readParcelable<GameDetailPlayer>(GameDetailPlayer::class.java.classLoader)
    }

    companion object {

        @JvmField
        val CREATOR: Parcelable.Creator<GameDetailContact> = object : Parcelable.Creator<GameDetailContact> {
            override fun createFromParcel(source: Parcel): GameDetailContact {
                return GameDetailContact(source)
            }

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