/// <reference path="OutfitItem.ts" />
/// <reference path="OutfitItemEnums.ts" />

class OutfitItemClothes extends OutfitItem implements OutfitDefinitionClothes{
	type:'clothes' = "clothes";
	isDress?: number;
	isOnepiece?: number;
	coverBack?: number;
	style?: number;
	style2?: number;
	style3?: number;
	bimbo?: number;

	subtype:string='';
	thinness:EClothesThinness=EClothesThinness.REVEALING;

	coverFront:number;
	coverTop:number;
	pantsShortness:EOutfitBottomShortness=EOutfitBottomShortness.NONE;
	skirtShortness:EOutfitBottomShortness=EOutfitBottomShortness.NONE;
	topcut: number;

	includesBra:number;
	includesPanties:number;

	inhib: number;

	get bottomShortness():EOutfitBottomShortness{
		return Math.max(this.pantsShortness,this.skirtShortness);
	}

	get desc():string{
		if(this.description)
			return this.description;

		const char:PlayerCharacter = State.variables.pc;

		let result = 'This is a ';

		result += this.qualityString + ' quality ';
		result += this.isDress ? 'dress' : 'outfit'
		
		switch(this.thinness){
			case EClothesThinness.OBSCURING:
				result += ', which obscures your figure';				break;
			case EClothesThinness.OBSCURING_SOMEWHAT:
				result += ', which somewhat obscures your figure';		break;
			case EClothesThinness.SHOWS_SOMEWHAT:
				result += ', which somewhat shows your figure';		break;
			case EClothesThinness.SHOWS:
				result += ', which shows your figure well';			break;
			case EClothesThinness.SHOWS_DETAILS:
				result += ', which shows every detail of your figure';	break;
			case EClothesThinness.REVEALING:
				result += ', which intentionally reveals your intimate areas';	break;
		}
		result += '.';

		switch(this.includesBra){
			case 2:
				result += ' The top leaves your breasts completely exposed';	break;
			case 1:
				result += ' The top is essentially a bra and replaces any you might be wearing';	break;
			default:
				result += 'It includes a ';
				switch (this.topcut){
					case 1:
						result += 'modest';	break;
					case 2:
						result += 'regular';	break;
					case 3:
						result += 'daring';	break;
					case 4:
						result += 'very revealing';	break;
				}
				result += ' cut top ';

				if(char.tits < 1 && this.topcut == 1){
					result += 'that would fit well over your flat chest';
				}else if(char.tits < 1 && this.topcut == 2){
					result += 'that would hang awkwardly around flat chest';
				}else if(char.tits < 1 && this.topcut == 3){
					result += 'that would hang very awkwardly around flat chest';
				}else if(char.tits < 1 && this.topcut == 4){
					result += 'that would hang extremely loosely over your flat chest';
				}else if(char.tits < 1){
					result += 'that would hang loosely around your flat chest';
				}else if(char.tits < 2 && this.topcut == 1){
					result += 'that would fit well over your tiny breasts';
				}else if(char.tits < 2 && this.topcut == 2){
					result += 'that would emphasize your lack of cleavage';
				}else if(char.tits < 2 && this.topcut == 3){
					result += 'that would hang loosely over your tiny breasts';
				}else if(char.tits < 2 && this.topcut == 4){
					result += 'that would drape breezily over your tiny breasts';
				}else if(char.tits < 2){
					result += 'that would hang loosely around your tiny breasts';
				}else if(char.tits < 3 && this.topcut == 1){
					result += 'that would fit well over your small breasts';
				}else if(char.tits < 3 && this.topcut == 2){
					result += 'that would slightly emphasize your small breasts';
				}else if(char.tits < 3 && this.topcut == 3){
					result += 'that would emphasize your small breasts';
				}else if(char.tits < 3 && this.topcut == 4){
					result += 'that would greatly emphasize your small breasts';
				}else if(char.tits < 3){
					result += 'that would hang loosely over your small breasts';
				}else if(char.tits < 4 && this.topcut == 1){
					result += 'that would fit well around your shapely breasts';
				}else if(char.tits < 4 && this.topcut == 2){
					result += 'that would help emphasize your shapely breasts';
				}else if(char.tits < 4 && this.topcut == 3){
					result += 'that would show off your shapely breasts';
				}else if(char.tits < 4 && this.topcut == 4){
					result += 'that would really show off your shapely breasts';
				}else if(char.tits < 4){
					result += 'that would fit well around your shapely breasts';
				}else if(char.tits < 6 && this.topcut == 1){
					result += 'that would comfortably wrap around your large breasts';
				}else if(char.tits < 6 && this.topcut == 2){
					result += 'that would help emphasize your large breasts';
				}else if(char.tits < 6 && this.topcut == 3){
					result += 'that would show off your large breasts';
				}else if(char.tits < 6 && this.topcut == 4){
					result += 'that would attract a lot of attention to your large breasts';
				}else if(char.tits < 6){
					result += 'that would comfortably wrap around your large breasts';
				}else if(char.tits < 8 && this.topcut == 1){
					result += 'that your ample bosom would strain against';
				}else if(char.tits < 8 && this.topcut == 2){
					result += 'that would emphasize the cleavage of your ample bosom';
				}else if(char.tits < 8 && this.topcut == 3){
					result += 'that would emphasize the size your exceptionally large breasts';
				}else if(char.tits < 8 && this.topcut == 4){
					result += 'that would draw everyone\'s eyes to your exceptionally large breasts';
				}else if(char.tits < 8){
					result += 'that would tightly strain to contain your ample bosom';
				}else if(this.topcut == 1){
					result += 'that would struggle to contain your huge breasts';
				}else if(this.topcut == 2){
					result += 'that would emphasize your enormous cleavage';
				}else if(this.topcut == 3){
					result += 'that your huge breasts would spill out of';
				}else if(this.topcut == 4){
					result += 'that might fail to contain your huge breasts';
				}else
					result += 'that would struggle to contain your huge breasts';
		}
		result += '.';

		if(this.isMaidOutfit)
			result += ' This is a maid uniform.';

		if(this.isSchoolOutfit)
			result += ' This is a school uniform.';

		if(this.isSportsOutfit)
			result += ' This is a sports outfit.';

		return result;
/*

			
		<</if>>
		<<if getvar("_itemData_cd.isDress") == 1>>
			<<if getvar("_itemData_cd.skirtShortness") == 1>>
				and a floor-length hemline.
			<<elseif getvar("_itemData_cd.skirtShortness") == 2>>
				and a knee-length hemline.
			<<elseif getvar("_itemData_cd.skirtShortness") == 3>>
				and a fairly standard hemline.
			<<elseif getvar("_itemData_cd.skirtShortness") == 4>>
				and a rather short hemline.
			<<elseif getvar("_itemData_cd.skirtShortness") == 5>>
				and a hemline that barely reaches past your groin.
			<<elseif getvar("_itemData_cd.skirtShortness") == 6>>
				and a hemline not even long enough to hide your privates.
			<</if>>
		<<elseif getvar("_itemData_cd.includesPanties") == 1>>
			the bottom of which is so skimpy it replaces your panties.
		<<elseif getvar("_itemData_cd.pantsShortness") > 0>>
			<<if getvar("_itemData_cd.pantsShortness") == 1>>
				and long pants.
			<<elseif getvar("_itemData_cd.pantsShortness") == 2>>
				and calf-length pants.
			<<elseif getvar("_itemData_cd.pantsShortness") == 3>>
				and knee-length shorts.
			<<elseif getvar("_itemData_cd.pantsShortness") == 4>>
				and thigh-length shorts.
			<<elseif getvar("_itemData_cd.pantsShortness") == 5>>
				and shorts that don`t go past your crotch.
			<<elseif getvar("_itemData_cd.pantsShortness") == 6>>
				and shorts so short, that they reveal your panties.
			<</if>>
		<<elseif getvar("_itemData_cd.skirtShortness") > 0>>
			<<if getvar("_itemData_cd.skirtShortness") == 1>>
				and a floor-length skirt.
			<<elseif getvar("_itemData_cd.skirtShortness") == 2>>
				and a knee-length skirt.
			<<elseif getvar("_itemData_cd.skirtShortness") == 3>>
				and an above knee length skirt.
			<<elseif getvar("_itemData_cd.skirtShortness") == 4>>
				and a rather short skirt.
			<<elseif getvar("_itemData_cd.skirtShortness") == 5>>
				and a miniskirt that barely reaches past your groin.
			<<elseif getvar("_itemData_cd.skirtShortness") == 6>>
				and a microskirt not even long enough to hide your privates.
			<</if>>
		<</if>>

		<<if getvar("_itemData_cd.bimbo") == 1>>
			This item is considered bimbo clothing.
		<</if>>
		<<if getvar("_itemData_cd.style") == 4>>
			This outfit can be used for prostitution.
		<</if>>

		<!-- !!CloStyle2: 1 Maid, 2 Server, 3 Stripper, 4 School-->
		<<switch _itemData_cd.style2>>
			<<case 1>>
				This is a maid outfit.
			<<case 2>>
				This outfit is a server uniform.
			<<case 3>>
				This outfit is a stripper uniform, suitable for jobs that require one.
			<<case 4>>
				This is a school uniform.
		<</switch>>
	<</if>>*/

	}

	get icon():string{
		let image:string='';
		if(this.isSchoolOutfit){
			if(this.inhibition >= 50){
				image = 'uniform_b';
			}else if(this.inhibition >= 40){
				image = 'uniform_s'
			}else if(this.inhibition >= 30){
				image = 'uniform_s'		
			}else if(this.inhibition >= 25){
				image = 'uniform_s'
			}else{
				image = 'uniform'
			}
		}
		else if(this.isSportsOutfit){
			if(this.inhibition >= 50){
				image = 'exercise_b';
			}else if(this.inhibition >= 40){
				image = 'exercise_s'
			}else if(this.inhibition >= 30){
				image = 'exercise_s'		
			}else if(this.inhibition >= 25){
				image = 'exercise_s'
			}else{
				image = 'exercise'
			}
		}
		else{
			if(this.inhibition >= 50){
				image = 'clothes_b';
			}else if(this.inhibition >= 40){
				image = 'clothes_s'
			}else if(this.inhibition >= 30){
				image = 'clothes_s'		
			}else if(this.inhibition >= 25){
				image = 'clothes_s'
			}else{
				image = 'clothes'
			}
		}
		return `system/icons/status/${image}.png`;
	}

	get imageLegacy():string{
		return setup.outfitItemImagePath.clothes[this.vendor][this.subtype].formatUnicorn({id:this.index});
	}

	get inhibition(){
		if(this.inhib)
			return this.inhib;

		let inhibitionOfItem = 0;
		if(this.coverFront == 4)
			inhibitionOfItem = 50
		else if(this.coverFront == 3 || this.coverTop == 4)
			inhibitionOfItem = 45
		else if(this.coverFront == 2 || this.coverTop == 3)
			inhibitionOfItem = 40
		else if(this.skirtShortness == 6 || this.coverFront == 1 || this.coverTop == 2)
			inhibitionOfItem = 35
		else if(this.skirtShortness == 5 || this.pantsShortness == 6){
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else
				inhibitionOfItem = 30
		}
		else if(this.includesPanties == 1 || this.pantsShortness == 5){
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else if(this.includesBra == 1 || this.coverTop == 2)
				inhibitionOfItem = 30
			else
				inhibitionOfItem = 25
		}
		else if(this.skirtShortness == 4){
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else if(this.includesBra == 1 || this.coverTop == 2)
				inhibitionOfItem = 30
			else if(this.topcut == 4 || this.thinness == 5)
				inhibitionOfItem = 25
			else
				inhibitionOfItem = 20
		}
		else if(this.skirtShortness == 3){
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else if(this.includesBra == 1 || this.coverTop == 2)
				inhibitionOfItem = 30
			else if(this.topcut == 4 || this.thinness == 5)
				inhibitionOfItem = 25
			else if(this.topcut == 3)
				inhibitionOfItem = 15
			else
				inhibitionOfItem = 10
		}
		else if(this.skirtShortness == 2 || this.pantsShortness == 3){
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else if(this.includesBra == 1 || this.coverTop == 2)
				inhibitionOfItem = 30
			else if(this.topcut == 4 || this.thinness == 5)
				inhibitionOfItem = 25
			else if(this.topcut == 3)
				inhibitionOfItem = 15
			else if(this.thinness == 4)
				inhibitionOfItem = 10
			else
				inhibitionOfItem = 5
		}
		else{
			if(this.thinness == 6)
				inhibitionOfItem = 35
			else if(this.includesBra == 1 || this.coverTop == 2)
				inhibitionOfItem = 30
			else if(this.topcut == 4 || this.thinness == 5)
				inhibitionOfItem = 25
			else if(this.topcut == 3)
				inhibitionOfItem = 15
			else if(this.thinness == 4)
				inhibitionOfItem = 10
			else if(this.thinness == 3)
				inhibitionOfItem = 5
			else
				inhibitionOfItem = 0
		}
		return inhibitionOfItem;
		
	}

	get isMaidOutfit(){
		return (this.subtype == 'maid');
	}

	get isSchoolOutfit():boolean{
		return (this.subtype == 'school');
	}

	get isSportsOutfit():boolean{
		return (this.vendor == 'danilovich');
	}

	get slots(){
		let slots = ['clothes'];
		if(this.includesBra)
			slots.push('bra');
		if(this.includesPanties)
			slots.push('panties');
		return slots;
	}
}