package com.home.commonBase.data.activity;
import com.home.commonBase.constlist.generate.BaseDataType;
import com.home.commonBase.data.system.PlayerWorkData;
import com.home.shine.bytes.BytesReadStream;
import com.home.shine.bytes.BytesWriteStream;
import com.home.shine.data.BaseData;
import com.home.shine.support.DataWriter;
import com.home.shine.support.pool.DataPool;

/** 使用激活码成功(generated by shine) */
public class UseActivationCodeSuccessOWData extends PlayerWorkData
{
	/** 数据类型ID */
	public static final int dataID=BaseDataType.UseActivationCodeSuccessOW;
	
	/** 码 */
	public String code="";
	
	/** 码id */
	public int id;
	
	public UseActivationCodeSuccessOWData()
	{
		_dataID=BaseDataType.UseActivationCodeSuccessOW;
	}
	
	/** 获取数据类名 */
	@Override
	public String getDataClassName()
	{
		return "UseActivationCodeSuccessOWData";
	}
	
	/** 读取字节流(完整版) */
	@Override
	protected void toReadBytesFull(BytesReadStream stream)
	{
		super.toReadBytesFull(stream);
		
		stream.startReadObj();
		
		this.code=stream.readUTF();
		
		this.id=stream.readInt();
		
		stream.endReadObj();
	}
	
	/** 写入字节流(完整版) */
	@Override
	protected void toWriteBytesFull(BytesWriteStream stream)
	{
		super.toWriteBytesFull(stream);
		
		stream.startWriteObj();
		
		stream.writeUTF(this.code);
		
		stream.writeInt(this.id);
		
		stream.endWriteObj();
	}
	
	/** 读取字节流(简版) */
	@Override
	protected void toReadBytesSimple(BytesReadStream stream)
	{
		super.toReadBytesSimple(stream);
		
		this.code=stream.readUTF();
		
		this.id=stream.readInt();
		
	}
	
	/** 写入字节流(简版) */
	@Override
	protected void toWriteBytesSimple(BytesWriteStream stream)
	{
		super.toWriteBytesSimple(stream);
		
		stream.writeUTF(this.code);
		
		stream.writeInt(this.id);
		
	}
	
	/** 复制(潜拷贝) */
	@Override
	protected void toShadowCopy(BaseData data)
	{
		super.toShadowCopy(data);
		
		if(!(data instanceof UseActivationCodeSuccessOWData))
			return;
		
		UseActivationCodeSuccessOWData mData=(UseActivationCodeSuccessOWData)data;
		
		this.code=mData.code;
		this.id=mData.id;
	}
	
	/** 复制(深拷贝) */
	@Override
	protected void toCopy(BaseData data)
	{
		super.toCopy(data);
		
		if(!(data instanceof UseActivationCodeSuccessOWData))
			return;
		
		UseActivationCodeSuccessOWData mData=(UseActivationCodeSuccessOWData)data;
		
		this.code=mData.code;
		
		this.id=mData.id;
		
	}
	
	/** 是否数据一致 */
	@Override
	protected boolean toDataEquals(BaseData data)
	{
		if(!super.toDataEquals(data))
			return false;
		
		UseActivationCodeSuccessOWData mData=(UseActivationCodeSuccessOWData)data;
		if(!this.code.equals(mData.code))
			return false;
		
		if(this.id!=mData.id)
			return false;
		
		return true;
	}
	
	/** 转文本输出 */
	@Override
	protected void toWriteDataString(DataWriter writer)
	{
		super.toWriteDataString(writer);
		
		writer.writeTabs();
		writer.sb.append("code");
		writer.sb.append(':');
		writer.sb.append(this.code);
		
		writer.writeEnter();
		writer.writeTabs();
		writer.sb.append("id");
		writer.sb.append(':');
		writer.sb.append(this.id);
		
		writer.writeEnter();
	}
	
	/** 初始化初值 */
	@Override
	public void initDefault()
	{
		super.initDefault();
		
	}
	
	/** 回池 */
	@Override
	protected void toRelease(DataPool pool)
	{
		super.toRelease(pool);
		
		this.code="";
		this.id=0;
	}
	
}
