package com.tofly.data.sql.dao;

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

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.tofly.ghrq_route.module.troubleType.domain.SysDeviceTypeBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "DB_SYS_DEVICE_TYPE".
*/
public class SysDeviceTypeBeanDao extends AbstractDao<SysDeviceTypeBean, Void> {

    public static final String TABLENAME = "DB_SYS_DEVICE_TYPE";

    /**
     * Properties of entity SysDeviceTypeBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, String.class, "id", false, "ID");
        public final static Property En_contact_layer_name = new Property(1, String.class, "en_contact_layer_name", false, "EN_CONTACT_LAYER_NAME");
        public final static Property Contact_layer_id = new Property(2, String.class, "contact_layer_id", false, "CONTACT_LAYER_ID");
        public final static Property Cn_contact_layer_name = new Property(3, String.class, "cn_contact_layer_name", false, "CN_CONTACT_LAYER_NAME");
        public final static Property Create_time = new Property(4, String.class, "create_time", false, "CREATE_TIME");
        public final static Property Name = new Property(5, String.class, "name", false, "NAME");
        public final static Property Point_type_id = new Property(6, String.class, "point_type_id", false, "POINT_TYPE_ID");
        public final static Property Sqlfilter = new Property(7, String.class, "sqlfilter", false, "SQLFILTER");
        public final static Property Point_type_name = new Property(8, String.class, "point_type_name", false, "POINT_TYPE_NAME");
    }


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

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"DB_SYS_DEVICE_TYPE\" (" + //
                "\"ID\" TEXT," + // 0: id
                "\"EN_CONTACT_LAYER_NAME\" TEXT," + // 1: en_contact_layer_name
                "\"CONTACT_LAYER_ID\" TEXT," + // 2: contact_layer_id
                "\"CN_CONTACT_LAYER_NAME\" TEXT," + // 3: cn_contact_layer_name
                "\"CREATE_TIME\" TEXT," + // 4: create_time
                "\"NAME\" TEXT," + // 5: name
                "\"POINT_TYPE_ID\" TEXT," + // 6: point_type_id
                "\"SQLFILTER\" TEXT," + // 7: sqlfilter
                "\"POINT_TYPE_NAME\" TEXT);"); // 8: point_type_name
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, SysDeviceTypeBean entity) {
        stmt.clearBindings();
 
        String id = entity.getId();
        if (id != null) {
            stmt.bindString(1, id);
        }
 
        String en_contact_layer_name = entity.getEn_contact_layer_name();
        if (en_contact_layer_name != null) {
            stmt.bindString(2, en_contact_layer_name);
        }
 
        String contact_layer_id = entity.getContact_layer_id();
        if (contact_layer_id != null) {
            stmt.bindString(3, contact_layer_id);
        }
 
        String cn_contact_layer_name = entity.getCn_contact_layer_name();
        if (cn_contact_layer_name != null) {
            stmt.bindString(4, cn_contact_layer_name);
        }
 
        String create_time = entity.getCreate_time();
        if (create_time != null) {
            stmt.bindString(5, create_time);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(6, name);
        }
 
        String point_type_id = entity.getPoint_type_id();
        if (point_type_id != null) {
            stmt.bindString(7, point_type_id);
        }
 
        String sqlfilter = entity.getSqlfilter();
        if (sqlfilter != null) {
            stmt.bindString(8, sqlfilter);
        }
 
        String point_type_name = entity.getPoint_type_name();
        if (point_type_name != null) {
            stmt.bindString(9, point_type_name);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, SysDeviceTypeBean entity) {
        stmt.clearBindings();
 
        String id = entity.getId();
        if (id != null) {
            stmt.bindString(1, id);
        }
 
        String en_contact_layer_name = entity.getEn_contact_layer_name();
        if (en_contact_layer_name != null) {
            stmt.bindString(2, en_contact_layer_name);
        }
 
        String contact_layer_id = entity.getContact_layer_id();
        if (contact_layer_id != null) {
            stmt.bindString(3, contact_layer_id);
        }
 
        String cn_contact_layer_name = entity.getCn_contact_layer_name();
        if (cn_contact_layer_name != null) {
            stmt.bindString(4, cn_contact_layer_name);
        }
 
        String create_time = entity.getCreate_time();
        if (create_time != null) {
            stmt.bindString(5, create_time);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(6, name);
        }
 
        String point_type_id = entity.getPoint_type_id();
        if (point_type_id != null) {
            stmt.bindString(7, point_type_id);
        }
 
        String sqlfilter = entity.getSqlfilter();
        if (sqlfilter != null) {
            stmt.bindString(8, sqlfilter);
        }
 
        String point_type_name = entity.getPoint_type_name();
        if (point_type_name != null) {
            stmt.bindString(9, point_type_name);
        }
    }

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

    @Override
    public SysDeviceTypeBean readEntity(Cursor cursor, int offset) {
        SysDeviceTypeBean entity = new SysDeviceTypeBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // en_contact_layer_name
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // contact_layer_id
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // cn_contact_layer_name
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // create_time
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // name
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // point_type_id
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // sqlfilter
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // point_type_name
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, SysDeviceTypeBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setEn_contact_layer_name(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setContact_layer_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setCn_contact_layer_name(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setCreate_time(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setPoint_type_id(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setSqlfilter(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setPoint_type_name(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(SysDeviceTypeBean entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(SysDeviceTypeBean entity) {
        return null;
    }

    @Override
    public boolean hasKey(SysDeviceTypeBean entity) {
        // TODO
        return false;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
