import { Point } from "@lincode/math"
import Defaults from "./utils/Defaults"
import { ExtractProps } from "./utils/extractProps"
import Nullable from "./utils/Nullable"
import NullableDefault from "./utils/NullableDefault"

export default interface ITexturedBasic {
    color: string
    fog: boolean
    opacity: number
    texture: Nullable<string | HTMLVideoElement>
    videoTexture: Nullable<string | HTMLVideoElement>
    alphaMap: Nullable<string>
    textureRepeat: Nullable<Point | number>
    textureFlipY: Nullable<boolean>
    textureRotation: Nullable<number>
}

export const texturedBasicSchema: Required<ExtractProps<ITexturedBasic>> = {
    color: String,
    fog: Boolean,
    opacity: Number,
    texture: [String, Object],
    videoTexture: [String, Object],
    alphaMap: String,
    textureRepeat: [Object, Number],
    textureFlipY: Boolean,
    textureRotation: Number
}

export const texturedBasicDefaults: Defaults<ITexturedBasic> = {
    color: "#ffffff",
    fog: true,
    opacity: 1,
    texture: undefined,
    videoTexture: undefined,
    alphaMap: undefined,
    textureRepeat: new NullableDefault({ x: 1, y: 1 }),
    textureFlipY: new NullableDefault(false),
    textureRotation: new NullableDefault(0)
}
