package com.zlm.hp.db.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.zlm.hp.entity.AudioInfo;

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

    public static final String TABLENAME = "AUDIO_INFO";

    /**
     * Properties of entity AudioInfo.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Status = new Property(0, int.class, "status", false, "STATUS");
        public final static Property Type = new Property(1, int.class, "type", false, "TYPE");
        public final static Property Keyword = new Property(2, String.class, "keyword", false, "KEYWORD");
        public final static Property ImageUrl = new Property(3, String.class, "imageUrl", false, "IMAGE_URL");
        public final static Property SpecialId = new Property(4, String.class, "specialId", false, "SPECIAL_ID");
        public final static Property SingerId = new Property(5, String.class, "singerId", false, "SINGER_ID");
        public final static Property AlbumId = new Property(6, String.class, "albumId", false, "ALBUM_ID");
        public final static Property SongName = new Property(7, String.class, "songName", false, "SONG_NAME");
        public final static Property SingerName = new Property(8, String.class, "singerName", false, "SINGER_NAME");
        public final static Property Hash = new Property(9, String.class, "hash", false, "HASH");
        public final static Property MvHash = new Property(10, String.class, "mvHash", false, "MV_HASH");
        public final static Property FileExt = new Property(11, String.class, "fileExt", false, "FILE_EXT");
        public final static Property FileSize = new Property(12, long.class, "fileSize", false, "FILE_SIZE");
        public final static Property FileSizeText = new Property(13, String.class, "fileSizeText", false, "FILE_SIZE_TEXT");
        public final static Property FilePath = new Property(14, String.class, "filePath", false, "FILE_PATH");
        public final static Property Duration = new Property(15, long.class, "duration", false, "DURATION");
        public final static Property DurationText = new Property(16, String.class, "durationText", false, "DURATION_TEXT");
        public final static Property CreateTime = new Property(17, String.class, "createTime", false, "CREATE_TIME");
        public final static Property Category = new Property(18, String.class, "category", false, "CATEGORY");
        public final static Property ChildCategory = new Property(19, String.class, "childCategory", false, "CHILD_CATEGORY");
        public final static Property DownloadUrl = new Property(20, String.class, "downloadUrl", false, "DOWNLOAD_URL");
        public final static Property MvPath = new Property(21, String.class, "mvPath", false, "MV_PATH");
    }


    public AudioInfoDao(DaoConfig config) {
        super(config);
    }
    
    public AudioInfoDao(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 + "\"AUDIO_INFO\" (" + //
                "\"STATUS\" INTEGER NOT NULL ," + // 0: status
                "\"TYPE\" INTEGER NOT NULL ," + // 1: type
                "\"KEYWORD\" TEXT," + // 2: keyword
                "\"IMAGE_URL\" TEXT," + // 3: imageUrl
                "\"SPECIAL_ID\" TEXT," + // 4: specialId
                "\"SINGER_ID\" TEXT," + // 5: singerId
                "\"ALBUM_ID\" TEXT," + // 6: albumId
                "\"SONG_NAME\" TEXT," + // 7: songName
                "\"SINGER_NAME\" TEXT," + // 8: singerName
                "\"HASH\" TEXT," + // 9: hash
                "\"MV_HASH\" TEXT," + // 10: mvHash
                "\"FILE_EXT\" TEXT," + // 11: fileExt
                "\"FILE_SIZE\" INTEGER NOT NULL ," + // 12: fileSize
                "\"FILE_SIZE_TEXT\" TEXT," + // 13: fileSizeText
                "\"FILE_PATH\" TEXT," + // 14: filePath
                "\"DURATION\" INTEGER NOT NULL ," + // 15: duration
                "\"DURATION_TEXT\" TEXT," + // 16: durationText
                "\"CREATE_TIME\" TEXT," + // 17: createTime
                "\"CATEGORY\" TEXT," + // 18: category
                "\"CHILD_CATEGORY\" TEXT," + // 19: childCategory
                "\"DOWNLOAD_URL\" TEXT," + // 20: downloadUrl
                "\"MV_PATH\" TEXT);"); // 21: mvPath
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, AudioInfo entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getStatus());
        stmt.bindLong(2, entity.getType());
 
        String keyword = entity.getKeyword();
        if (keyword != null) {
            stmt.bindString(3, keyword);
        }
 
        String imageUrl = entity.getImageUrl();
        if (imageUrl != null) {
            stmt.bindString(4, imageUrl);
        }
 
        String specialId = entity.getSpecialId();
        if (specialId != null) {
            stmt.bindString(5, specialId);
        }
 
        String singerId = entity.getSingerId();
        if (singerId != null) {
            stmt.bindString(6, singerId);
        }
 
        String albumId = entity.getAlbumId();
        if (albumId != null) {
            stmt.bindString(7, albumId);
        }
 
        String songName = entity.getSongName();
        if (songName != null) {
            stmt.bindString(8, songName);
        }
 
        String singerName = entity.getSingerName();
        if (singerName != null) {
            stmt.bindString(9, singerName);
        }
 
        String hash = entity.getHash();
        if (hash != null) {
            stmt.bindString(10, hash);
        }
 
        String mvHash = entity.getMvHash();
        if (mvHash != null) {
            stmt.bindString(11, mvHash);
        }
 
        String fileExt = entity.getFileExt();
        if (fileExt != null) {
            stmt.bindString(12, fileExt);
        }
        stmt.bindLong(13, entity.getFileSize());
 
        String fileSizeText = entity.getFileSizeText();
        if (fileSizeText != null) {
            stmt.bindString(14, fileSizeText);
        }
 
        String filePath = entity.getFilePath();
        if (filePath != null) {
            stmt.bindString(15, filePath);
        }
        stmt.bindLong(16, entity.getDuration());
 
        String durationText = entity.getDurationText();
        if (durationText != null) {
            stmt.bindString(17, durationText);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(18, createTime);
        }
 
        String category = entity.getCategory();
        if (category != null) {
            stmt.bindString(19, category);
        }
 
        String childCategory = entity.getChildCategory();
        if (childCategory != null) {
            stmt.bindString(20, childCategory);
        }
 
        String downloadUrl = entity.getDownloadUrl();
        if (downloadUrl != null) {
            stmt.bindString(21, downloadUrl);
        }
 
        String mvPath = entity.getMvPath();
        if (mvPath != null) {
            stmt.bindString(22, mvPath);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, AudioInfo entity) {
        stmt.clearBindings();
        stmt.bindLong(1, entity.getStatus());
        stmt.bindLong(2, entity.getType());
 
        String keyword = entity.getKeyword();
        if (keyword != null) {
            stmt.bindString(3, keyword);
        }
 
        String imageUrl = entity.getImageUrl();
        if (imageUrl != null) {
            stmt.bindString(4, imageUrl);
        }
 
        String specialId = entity.getSpecialId();
        if (specialId != null) {
            stmt.bindString(5, specialId);
        }
 
        String singerId = entity.getSingerId();
        if (singerId != null) {
            stmt.bindString(6, singerId);
        }
 
        String albumId = entity.getAlbumId();
        if (albumId != null) {
            stmt.bindString(7, albumId);
        }
 
        String songName = entity.getSongName();
        if (songName != null) {
            stmt.bindString(8, songName);
        }
 
        String singerName = entity.getSingerName();
        if (singerName != null) {
            stmt.bindString(9, singerName);
        }
 
        String hash = entity.getHash();
        if (hash != null) {
            stmt.bindString(10, hash);
        }
 
        String mvHash = entity.getMvHash();
        if (mvHash != null) {
            stmt.bindString(11, mvHash);
        }
 
        String fileExt = entity.getFileExt();
        if (fileExt != null) {
            stmt.bindString(12, fileExt);
        }
        stmt.bindLong(13, entity.getFileSize());
 
        String fileSizeText = entity.getFileSizeText();
        if (fileSizeText != null) {
            stmt.bindString(14, fileSizeText);
        }
 
        String filePath = entity.getFilePath();
        if (filePath != null) {
            stmt.bindString(15, filePath);
        }
        stmt.bindLong(16, entity.getDuration());
 
        String durationText = entity.getDurationText();
        if (durationText != null) {
            stmt.bindString(17, durationText);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(18, createTime);
        }
 
        String category = entity.getCategory();
        if (category != null) {
            stmt.bindString(19, category);
        }
 
        String childCategory = entity.getChildCategory();
        if (childCategory != null) {
            stmt.bindString(20, childCategory);
        }
 
        String downloadUrl = entity.getDownloadUrl();
        if (downloadUrl != null) {
            stmt.bindString(21, downloadUrl);
        }
 
        String mvPath = entity.getMvPath();
        if (mvPath != null) {
            stmt.bindString(22, mvPath);
        }
    }

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

    @Override
    public AudioInfo readEntity(Cursor cursor, int offset) {
        AudioInfo entity = new AudioInfo();
        readEntity(cursor, entity, offset);
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, AudioInfo entity, int offset) {
        entity.setStatus(cursor.getInt(offset + 0));
        entity.setType(cursor.getInt(offset + 1));
        entity.setKeyword(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setImageUrl(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setSpecialId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setSingerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setAlbumId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setSongName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setSingerName(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setHash(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setMvHash(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setFileExt(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setFileSize(cursor.getLong(offset + 12));
        entity.setFileSizeText(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setFilePath(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setDuration(cursor.getLong(offset + 15));
        entity.setDurationText(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setCreateTime(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setCategory(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setChildCategory(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setDownloadUrl(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setMvPath(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(AudioInfo entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(AudioInfo entity) {
        return null;
    }

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

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