<Ui>
	
	<Frame name="$parentCounter" inherits="TellMeWhen_EventContainer" parentKey="Counter">
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentHeader" inherits="GameFontNormalLarge" parentKey="Header" justifyH="LEFT" text="">
					<Anchors>
						<Anchor point="BOTTOM" relativePoint="TOP" y="1"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>

		<Frames>
			
			<EditBox name="$parentCounter" inherits="TellMeWhen_InputBoxTemplate" parentKey="Counter" autoFocus="false">
				<Size x="130" y="15"/>
				<Attributes>
  					<Attribute name="tmw-class" type="string" value="Config_EditBox_Event"/>
 				</Attributes>

  				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" x="10" y="-22"/>
				</Anchors>

				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parentTitle" parentKey="Title" inherits="GameFontNormalSmall" justifyH="CENTER">
							<Anchors>
								<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" y="2"/>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>

				<Scripts>
					<OnLoad>
						self.Title:SetText(TMW.L["EVENTS_SETTINGS_COUNTER_NAME"])

						TMW:CInit(self, {
							setting = "Counter",
							title = TMW.L["EVENTS_SETTINGS_COUNTER_NAME"],
							tooltip = TMW.L["EVENTS_SETTINGS_COUNTER_NAME_DESC"],
							ModifySettingValue = function(self, value)
								local Counter = TMW.EVENTS:GetEventHandler("Counter")
								return Counter:SanitizeCounterName(value)
							end,
						})

						TMW.SUG:EnableEditBox(self, "counterName", true)

					</OnLoad>
				</Scripts>
			</EditBox>
			<Frame name="$parentOperation" parentKey="Operation" inherits="TMW_DropDownMenuTemplate">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentCounter" relativePoint="RIGHT" x="6" y="-3"/>
				</Anchors>

				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parentTitle" parentKey="Title" inherits="GameFontNormalSmall" justifyH="CENTER">
							<Anchors>
								<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" x="20" y="-0.5"/>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>

				<Scripts>
					<OnLoad>
						TMW:CInit(self, {
							title = TMW.L["EVENTS_SETTINGS_COUNTER_OP"],
							tooltip = TMW.L["EVENTS_SETTINGS_COUNTER_OP_DESC"],
							
							func = TMW.EVENTS:GetEventHandler("Counter").OperationMenu_DropDown,
						})

						self.Title:SetText(TMW.L["EVENTS_SETTINGS_COUNTER_OP"])

						self:SetWidth(96)
					</OnLoad>
				</Scripts>
			</Frame>

			<EditBox name="$parentAmt" inherits="TellMeWhen_InputBoxTemplate" parentKey="Amt" autoFocus="false">
				<Size x="55" y="15"/>

				<Attributes>
  					<Attribute name="tmw-class" type="string" value="Config_EditBox_Event"/>
 				</Attributes>

				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentOperation" relativePoint="RIGHT" x="8" y="3"/>
				</Anchors>

				<Layers>
					<Layer level="OVERLAY">
						<FontString name="$parentTitle" parentKey="Title" inherits="GameFontNormalSmall" justifyH="CENTER">
							<Anchors>
								<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" y="2"/>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
				
				<Scripts>
					<OnLoad>
						self.Title:SetText(TMW.L["EVENTS_SETTINGS_COUNTER_AMOUNT"])

						TMW:CInit(self, {
							setting = "CounterAmt",
							title = TMW.L["EVENTS_SETTINGS_COUNTER_AMOUNT"],
							tooltip = TMW.L["EVENTS_SETTINGS_COUNTER_AMOUNT_DESC"],
							ModifySettingValue = function(self, value)
								local Counter = TMW.EVENTS:GetEventHandler("Counter")
								return tonumber(self:GetText():trim()) or 0
							end,
						})
					</OnLoad>
				</Scripts>
			</EditBox>
		</Frames>

	</Frame>
	
</Ui>