package com.sharefaith.thesharefaithapp.models;

import com.appideas.base.AiSTr;

import java.util.HashMap;

/**
 * Created by Anthony on 3/18/16.
 * Model for Bible Book
 */
public class SFBookModel
{
    /** Abbreviation of Bible version */
    public String mAbbreviation;
    /** Full name of Bible version */
    public String mFullname;
    /** Id of Bible book */
    public int mBookId;
    /** number of chapters in book */
    public int mNumChapters;
    public int mPriority;
    /** Array of chapters for book */
    public SFChapterModel mChapters[];

    public SFBookModel(HashMap<String,String> bookData)
    {
        updateMembers(bookData);
        mChapters = new SFChapterModel[mNumChapters];
        for(int i = 0; i < mNumChapters; i++ )
        {
            mChapters[i] = new SFChapterModel( i+1 );
        }
    }

    public void updateMembers(HashMap<String,String> bookData)
    {
        this.mAbbreviation = bookData.get( "abbreviation" );
        this.mFullname = bookData.get( "full_name" );
        this.mBookId = AiSTr.denullifyInt(  bookData.get( "book_id" ) );
        this.mNumChapters = AiSTr.denullifyInt(  bookData.get( "last_chapter" ) );
        this.mPriority = AiSTr.denullifyInt(  bookData.get( "book_order" ) );
    }
}
