import { CodeBlocksActionTypes, INIT_CODEBLOCKS, CodeBlock, REMOVE_CODEBLOCK, INSERT_CODEBLOCK } from "./types";
import { LevelInitializer } from "../../game/levels";

export function initCodeBlocks(level: LevelInitializer): CodeBlocksActionTypes {
    return { type: INIT_CODEBLOCKS, level: level }
}

export function removeCodeBlock(idxCodeblocks: number, idxBlocks: number): CodeBlocksActionTypes {
    return {
        type: REMOVE_CODEBLOCK,
        containerIdx: idxCodeblocks,
        blocksIdx: idxBlocks
    }
}

export function insertCodeBlock(block: CodeBlock, containerIdx: number, blockIdx: number, overwrite: boolean): CodeBlocksActionTypes {
    return {
        type: INSERT_CODEBLOCK,
        containerIdx: containerIdx,
        blocksIdx: blockIdx,
        block: block,
        overwrite: overwrite
    }
}

