import { _decorator, ccenum } from 'cc';
const { ccclass, property } = _decorator;

export enum CardTypes
{
    CT_ICON_1 = 0, 
    CT_ICON_2 = 1, 
    CT_ICON_3 = 2, 
    CT_ICON_4 = 3,

    CT_ICON_5 = 4,
    CT_ICON_6 = 5,
    CT_ICON_7 = 6,
    CT_ICON_8 = 7,
    
    CT_ICON_9 = 8,
    CT_ICON_10 = 9,
    CT_ICON_11 = 10,
    CT_ICON_12 = 11,

    CT_ICON_13 = 12,
    CT_ICON_14 = 13,
    CT_ICON_15 = 14,
    CT_ICON_16 = 15,

    CT_ICON_17 = 16,
    CT_ICON_18 = 17,

    CT_ICON_19 = 18,
    CT_ICON_20 = 19,
    CT_ICON_21 = 20,
    CT_ICON_22 = 21,
    CT_ICON_23 = 22,
    CT_ICON_24 = 23,
}
ccenum(CardTypes);

@ccclass('PanelData')
export class PanelData {}

@ccclass('SettingsData')
export class AudioSettingsData
{
    public musicToggle: boolean = true;
    public soundToggle: boolean = true;
}

@ccclass('SettingsData')
export class SettingsData
{
    public audioSettingsData: AudioSettingsData = null;
}

@ccclass('CardMatchData')
export class CardMatchData
{
    @property({type: CardTypes})
    public m_Type: CardTypes;

    @property({type: Number, serializable: false})
    public m_MatchCounter: number = 0;
}

@ccclass('UnlockData')
export class UnlockData
{
    @property({type: Number})
    public cardsLeft: number = 0;

    @property({type: Number})
    public turnsCount: number = 0;

    @property({type: [CardMatchData]})
    public cardsMatchData: CardMatchData[] = [];
}

@ccclass('LevelData')
export class LevelData 
{
    @property({type: Number})
    public level: number = 0;

    @property({type: Number})
    public row: number = 0;

    @property({type: Number})
    public col: number = 0;

    @property({type: Boolean})
    public unlocked: boolean = false;

    @property({type: UnlockData})
    public unlockData: UnlockData = null;
}

@ccclass("UserData")
export class UserLevelData extends PanelData
{
    public selectedLevel: number = 1;
    public lastUnlockedLevel: number = 1;
    public levelDatas: LevelData[] = [];
}

@ccclass('GameData')
export class UserGameData
{
    @property({type: [UserLevelData]})
    public userLevelData: UserLevelData = null;

    @property({type: SettingsData})
    public settingsData: SettingsData = null;
}


