package com.sheep.gamegroup.greendao.download;

import com.sheep.gamegroup.model.entity.UserEntity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class Account {

    @Id(autoincrement = true)
    private Long id;
    @Property(nameInDb = "loginname")
    private String loginname;
    @Property(nameInDb = "aid")
    private String aid;
    @Property(nameInDb = "nickname")
    private String nickname;
    @Property(nameInDb = "avatar")
    private String avatar;
    @Property(nameInDb = "gender")
    private int gender;
    @Generated(hash = 579786552)
    public Account(Long id, String loginname, String aid, String nickname,
            String avatar, int gender) {
        this.id = id;
        this.loginname = loginname;
        this.aid = aid;
        this.nickname = nickname;
        this.avatar = avatar;
        this.gender = gender;
    }
    @Generated(hash = 882125521)
    public Account() {
    }
    public int getGender() {
        return this.gender;
    }
    public void setGender(int gender) {
        this.gender = gender;
    }
    public String getAvatar() {
        return this.avatar;
    }
    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
    public String getNickname() {
        return this.nickname;
    }
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    public String getLoginname() {
        return this.loginname;
    }
    public void setLoginname(String loginname) {
        this.loginname = loginname;
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    public String getAid() {
        return aid;
    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public static Account generateByUser(UserEntity user){
        Account account = new Account();
        account.setAid(user.getId());
        account.setLoginname(user.getUser_name());
        account.setNickname(user.getNickname());
        account.setAvatar(user.getAvatar());
        account.setGender(user.getGender());
        return account;
    }

}
