package org.zarroboogs.weibo.greendao.dao;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;

import org.zarroboogs.weibo.greendao.bean.Green_AtUsersBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * DAO for table "atusers_table".
 */
public class Green_AtUsersBeanDao extends AbstractDao<Green_AtUsersBean, Void> {

    public static final String TABLENAME = "atusers_table";

    /**
     * Properties of entity Green_AtUsersBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Accountid = new Property(0, String.class, "accountid", false, "ACCOUNTID");
        public final static Property Userid = new Property(1, String.class, "userid", false, "USERID");
        public final static Property At_user_info_json = new Property(2, String.class, "at_user_info_json", false, "AT_USER_INFO_JSON");
    }


    public Green_AtUsersBeanDao(DaoConfig config) {
        super(config);
    }

    public Green_AtUsersBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /**
     * Creates the underlying database table.
     */
    public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
        String constraint = ifNotExists ? "IF NOT EXISTS " : "";
        db.execSQL("CREATE TABLE " + constraint + "\"atusers_table\" (" + //
                "\"ACCOUNTID\" TEXT," + // 0: accountid
                "\"USERID\" TEXT," + // 1: userid
                "\"AT_USER_INFO_JSON\" TEXT);"); // 2: at_user_info_json
    }

    /**
     * Drops the underlying database table.
     */
    public static void dropTable(SQLiteDatabase db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"atusers_table\"";
        db.execSQL(sql);
    }

    /**
     * @inheritdoc
     */
    @Override
    protected void bindValues(SQLiteStatement stmt, Green_AtUsersBean entity) {
        stmt.clearBindings();

        String accountid = entity.getAccountid();
        if (accountid != null) {
            stmt.bindString(1, accountid);
        }

        String userid = entity.getUserid();
        if (userid != null) {
            stmt.bindString(2, userid);
        }

        String at_user_info_json = entity.getAt_user_info_json();
        if (at_user_info_json != null) {
            stmt.bindString(3, at_user_info_json);
        }
    }

    /**
     * @inheritdoc
     */
    @Override
    public Void readKey(Cursor cursor, int offset) {
        return null;
    }

    /**
     * @inheritdoc
     */
    @Override
    public Green_AtUsersBean readEntity(Cursor cursor, int offset) {
        Green_AtUsersBean entity = new Green_AtUsersBean( //
                cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // accountid
                cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // userid
                cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2) // at_user_info_json
        );
        return entity;
    }

    /**
     * @inheritdoc
     */
    @Override
    public void readEntity(Cursor cursor, Green_AtUsersBean entity, int offset) {
        entity.setAccountid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setUserid(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setAt_user_info_json(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
    }

    /**
     * @inheritdoc
     */
    @Override
    protected Void updateKeyAfterInsert(Green_AtUsersBean entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }

    /**
     * @inheritdoc
     */
    @Override
    public Void getKey(Green_AtUsersBean entity) {
        return null;
    }

    /**
     * @inheritdoc
     */
    @Override
    protected boolean isEntityUpdateable() {
        return true;
    }

}
