// Path: app/src/main/java/com/w9jds/marketbot/classes/models/Region.java
// public final class Region extends MarketItemBase {
// 
//     private String href;
// 
//     public String getHref() {
//         return href;
//     }
// 
//     public static class Builder {
// 
//         private long id;
//         private String name;
//         private String href;
// 
//         public Builder setId(long id) {
//             this.id = id;
//             return this;
//         }
// 
//         public Builder setHref(String href) {
//             this.href = href;
//             return this;
//         }
// 
//         public Builder setName(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Region build() {
//             Region region = new Region();
//             region.id = this.id;
//             region.name = this.name;
//             region.href = this.href;
// 
//             return region;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/com/w9jds/marketbot/data/MarketDatabase.java
// @Database(name = MarketDatabase.NAME, version = MarketDatabase.VERSION)
// public class MarketDatabase {
// 
//     public static final String NAME = "MarketBotDb";
//     public static final int VERSION = 3;
// 
// 
//     public interface TransactionListener {
//         void onTransactionProgressUpdate(int progress, int max);
//     }
// }


import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
import com.raizlabs.android.dbflow.runtime.TransactionManager;
import com.raizlabs.android.dbflow.runtime.transaction.process.ProcessModelInfo;
import com.raizlabs.android.dbflow.runtime.transaction.process.SaveModelTransaction;
import com.raizlabs.android.dbflow.sql.language.OrderBy;
import com.raizlabs.android.dbflow.sql.language.Select;
import com.raizlabs.android.dbflow.structure.BaseModel;
import com.w9jds.marketbot.classes.models.Region;
import com.w9jds.marketbot.data.MarketDatabase;
import org.devfleet.crest.model.CrestItem;
import java.util.ArrayList;
import java.util.List;
package com.w9jds.marketbot.data.storage;




@Table(database = MarketDatabase.class, name = "Regions")
public final class RegionEntry extends BaseModel {

    @PrimaryKey
    long id;

    @Column
    String name;

    @Column
    String href;

    public static void addRegions(List<CrestItem> regions) {
        int size = regions.size();
        List<RegionEntry> entries = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            CrestItem region = regions.get(i);

            RegionEntry entry = new RegionEntry();
            entry.id = region.getId();
            entry.name = region.getName();
            entry.href = region.getHref();
            entries.add(entry);
        }

        TransactionManager.getInstance().addTransaction(new SaveModelTransaction<>(
                ProcessModelInfo.withModels(entries)));
    }

// Path: app/src/main/java/com/w9jds/marketbot/classes/models/Region.java
// public final class Region extends MarketItemBase {
// 
//     private String href;
// 
//     public String getHref() {
//         return href;
//     }
// 
//     public static class Builder {
// 
//         private long id;
//         private String name;
//         private String href;
// 
//         public Builder setId(long id) {
//             this.id = id;
//             return this;
//         }
// 
//         public Builder setHref(String href) {
//             this.href = href;
//             return this;
//         }
// 
//         public Builder setName(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Region build() {
//             Region region = new Region();
//             region.id = this.id;
//             region.name = this.name;
//             region.href = this.href;
// 
//             return region;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/com/w9jds/marketbot/data/MarketDatabase.java
// @Database(name = MarketDatabase.NAME, version = MarketDatabase.VERSION)
// public class MarketDatabase {
// 
//     public static final String NAME = "MarketBotDb";
//     public static final int VERSION = 3;
// 
// 
//     public interface TransactionListener {
//         void onTransactionProgressUpdate(int progress, int max);
//     }
// }


// Path: app/src/main/java/com/w9jds/marketbot/data/storage/RegionEntry.java
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
import com.raizlabs.android.dbflow.runtime.TransactionManager;
import com.raizlabs.android.dbflow.runtime.transaction.process.ProcessModelInfo;
import com.raizlabs.android.dbflow.runtime.transaction.process.SaveModelTransaction;
import com.raizlabs.android.dbflow.sql.language.OrderBy;
import com.raizlabs.android.dbflow.sql.language.Select;
import com.raizlabs.android.dbflow.structure.BaseModel;
import com.w9jds.marketbot.classes.models.Region;
import com.w9jds.marketbot.data.MarketDatabase;
import org.devfleet.crest.model.CrestItem;
import java.util.ArrayList;
import java.util.List;

package com.w9jds.marketbot.data.storage;




@Table(database = MarketDatabase.class, name = "Regions")
public final class RegionEntry extends BaseModel {

    @PrimaryKey
    long id;

    @Column
    String name;

    @Column
    String href;

    public static void addRegions(List<CrestItem> regions) {
        int size = regions.size();
        List<RegionEntry> entries = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            CrestItem region = regions.get(i);

            RegionEntry entry = new RegionEntry();
            entry.id = region.getId();
            entry.name = region.getName();
            entry.href = region.getHref();
            entries.add(entry);
        }

        TransactionManager.getInstance().addTransaction(new SaveModelTransaction<>(
                ProcessModelInfo.withModels(entries)));
    }

    private static List<Region> buildRegions(List<RegionEntry> entries) {