#ifndef _CONTENT_H_
#define _CONTENT_H_

#define CKG_CM_MAX_COLORS_PER_ITEM 4

/*!
    \brief  Item types define where an item is worn.

            Due to layering support, multiple items per position can be worn.
*/
typedef enum
{
    // Lower 4 bits are sub locations (0 - 3)
    CKG_CM_SubItem_BASE             = 0,
    CKG_CM_SubItem_MASK             = 0xF,

    CKG_CM_SubItem_Default          = CKG_CM_SubItem_BASE,
    CKG_CM_SubItem_Upper            = (1 << (CKG_CM_SubItem_BASE + 0)),
    CKG_CM_SubItem_Middle           = (1 << (CKG_CM_SubItem_BASE + 1)),
    CKG_CM_SubItem_Lower            = (1 << (CKG_CM_SubItem_BASE + 2)),
    CKG_CM_SubItem_Unused           = (1 << (CKG_CM_SubItem_BASE + 3)),

    // Next 8 bits are Patterns  (4 - 15)
    CKG_CM_Pattern_BASE             = 4,
    CKG_CM_Pattern_MASK             = 0xFF0,

    CKG_CM_Pattern_Solid            = (1 << (CKG_CM_Pattern_BASE + 0)),
    CKG_CM_Pattern_Stripe_Vertical  = (1 << (CKG_CM_Pattern_BASE + 1)),
    CKG_CM_Pattern_Stripe_Horizontal= (1 << (CKG_CM_Pattern_BASE + 2)),
    CKG_CM_Pattern_Stripe_Diagonal  = (1 << (CKG_CM_Pattern_BASE + 3)),
    CKG_CM_Pattern_Plaid            = (1 << (CKG_CM_Pattern_BASE + 4)),

    // Upper bits are all primary items (16+)
    CKG_CM_Item_BASE                = 16,
    CKG_CM_Item_MASK                = ~(CKG_CM_SubItem_MASK | CKG_CM_Pattern_MASK),

    CKG_CM_Item_Type_Head           = (1 << (CKG_CM_Item_BASE + 0)),      // Headware
    CKG_CM_Item_Type_Torso          = (1 << (CKG_CM_Item_BASE + 1)),      // Torsoware, shirts, bras, etc
    CKG_CM_Item_Type_Arm            = (1 << (CKG_CM_Item_BASE + 2)),      // Arm covers etc (goths)
    CKG_CM_Item_Type_Wrist          = (1 << (CKG_CM_Item_BASE + 3)),      // Watches, bracelets, etc
    CKG_CM_Item_Type_Finger         = (1 << (CKG_CM_Item_BASE + 4)),      // Rings and such
    CKG_CM_Item_Type_Pelvic         = (1 << (CKG_CM_Item_BASE + 5)),      // Underwear
    CKG_CM_Item_Type_Leg            = (1 << (CKG_CM_Item_BASE + 6)),      // Pants, skirts, etc
    CKG_CM_Item_Type_Foot           = (1 << (CKG_CM_Item_BASE + 7)),      // Footwear, etc
}  CKG_CM_ItemTypeInfo;

/*!
    \brief  Color structure is used to define color
*/
typedef struct
{
    unsigned int r;
    unsigned int g;
    unsigned int b;
} CKG_CM_Color;

/*!
    \brief  Item itself holds the data for each given item
*/
typedef struct
{
    CKG_CM_Color            color[CKG_CM_MAX_COLORS_PER_ITEM];
    CKG_CM_ItemTypeInfo		itemTypeInfo;
    void                    *picture;
    char                    numColors;
} CKG_CM_Item;

extern CKG_CM_Item *CKG_CM_InitItem(CKG_CM_Item *item);

#endif
