/**
 * 
 * !!!!!! WHEN EDITING THIS FILE, ALSO EDIT THE ./typesZod.ts FILE !!!!!
 * !!!!!! WHEN EDITING THIS FILE, ALSO EDIT THE ./typesZod.ts FILE !!!!!
 * !!!!!! WHEN EDITING THIS FILE, ALSO EDIT THE ./typesZod.ts FILE !!!!!
 * !!!!!! WHEN EDITING THIS FILE, ALSO EDIT THE ./typesZod.ts FILE !!!!!
 * 
 * NEVER IMPORT THIS TO THE "LIBRARY", only to be used in the Editor!!! 
 * *** COPY OF THIS IS ALSO IN THE canvas2d ***
 *  
 * 1) copy ./types.ts
 * 2) go to https://transform.tools/typescript-to-zod and paste
 * 3) copy the result and paste it here
 * 4) (optional) - zod custom error messages (AI GENERATED)
 * 
 * 
 * 
 */

// UTILITY TYPES
export type MediaGroupPositionAndSize = {
	bgSize?: 'contain' |'cover' | 'custom', // todo custom, if undefined, default is 'contain???'
	bgPosition?: { // if undefined, default is {x:0.5, y:0.5}
	  x: number
	  y: number
	}	
}
// This is only here because i wanted to have it as separate type, but it may not be used anywhere else.
export type ImagesWpArray = Array <
	number 
	// | // do not work with wp media adder for now.
	// {
	// 	i:number, 
	// 	//d?:number, // no depth map for now 
	// 	dur?:number
	// }
>
// This is only here because i wanted to have it as separate type, but it may not be used anywhere else.
export type ImagesUrlListArray = Array <
	string | 
	{
		i:string, 
		// d?:string, // no depth map for now
		dur?:number
	}
>


// 2D IMAGE TYPES
export type ImageGroupWp = MediaGroupPositionAndSize & {
	type: 'wpMedia'
	images: ImagesWpArray
	duration?: number // optional group duration
} 
export type ImageGroupUrlList = MediaGroupPositionAndSize & {
	type: 'urlList'
	prefix?: string
	suffix?: string
	images: ImagesUrlListArray
	duration?: number // optional group duration
}
export type ImageGroupGap =  {
	type: 'gap'
	duration: number
}

export type ImageGroup = ImageGroupGap | ImageGroupWp | ImageGroupUrlList
export type ImageGroups = ImageGroup[]

// 2D VIDEO TYPES 
export type VideoGroupWp = MediaGroupPositionAndSize & {
	type: 'wpVideo'
	video?: number
	duration?: number // optional group duration
}
export type VideoGroupUrl = MediaGroupPositionAndSize & {
	type: 'urlVideo'
	video?: string
	duration?: number // optional group duration
}

export type VideoGroup = VideoGroupWp | VideoGroupUrl

// GENERAL TYPES
export type MediaGroup = ImageGroup | VideoGroup
export type MediaGroups = MediaGroup[]













// OBSOLETE 
// export type Media2dWpDepthMap = PositionAndSize & {
// 	type: 'wp-depthmap' 
// 	images: 
// 		{
// 			i: number
// 			d?: number // depth map
// 			dur?: number // optional individual duration
// 		}[]
// } 

// export type Media2dUrlDepthmap = PositionAndSize & {
// 	type: 'url-depthmap'
// 	root?: string
// 	images: 
// 		string[] | // array of image urls all have the same duration
// 		{ // array of image urls with optional individual durations
// 			i: string
// 			d?: string // depth map
// 			dur?: number
// 		}[]
// }