import { LevelInitializer } from "../../game/levels";

export const INIT_CODEBLOCKS = "INIT_CODEBLOCKS"
export const REMOVE_CODEBLOCK = "REMOVE_CODEBLOCK"
export const INSERT_CODEBLOCK = "INSERT_CODEBLOCK"
export const SET_DROPZONE_Z_INDEX = "SET_DROPZONE_Z_INDEX"

export interface CodeBlock {
    name: string,
    containerIndex?: number,
    // parent: CodeBlockContainer
}

export interface CodeBlockContainer {
    name: string,
    nMaxBlocks: number,
    blocks: Array<CodeBlock>
}

export interface InitCodeBlocksAction {
    type: typeof INIT_CODEBLOCKS,
    level: LevelInitializer
}

export interface RemoveCodeBlockAction {
    type: typeof REMOVE_CODEBLOCK,
    containerIdx: number,
    blocksIdx: number,
}

export interface InsertCodeBlockAction {
    type: typeof INSERT_CODEBLOCK,
    containerIdx: number,
    blocksIdx: number
    block: CodeBlock,
    overwrite: boolean
}

export interface SetDropZoneZIdxAction {
    type: typeof SET_DROPZONE_Z_INDEX,
    zIdx: number
}

export type CodeBlocksActionTypes =
    InitCodeBlocksAction
    | RemoveCodeBlockAction
    | InsertCodeBlockAction
    | SetDropZoneZIdxAction
