﻿SET IDENTITY_INSERT [T_CONFIGTIPUS] ON
---------------------------------------
INSERT INTO T_CONFIGTIPUS ([ID], [C_CONFIG], [C_MODUL], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
VALUES
	(1, 'IsEnabled', 'ESL', 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL)
	,(2, 'Url', 'ESL', 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL)
	,(3, 'IsEnabled', 'Fokusz', 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL)
	,(4, 'Url', 'Fokusz', 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL)
	,(5, 'IsEnabled', 'HRModul', 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL)
---------------------------------------
SET IDENTITY_INSERT [T_CONFIGTIPUS] OFF

DECLARE @EnvironmentName nvarchar(1000)
	SET @EnvironmentName = (SELECT TOP 1 [Value] FROM dev.EnvironmentInfo WHERE [Key] = 'Kornyezet')

DECLARE @eslUrl nvarchar(255) = CASE @EnvironmentName
  WHEN 'AZURE' THEN 'https://esl-ema.e-kreta.hu/sso'
  WHEN 'HOI' THEN 'https://esl-hoi.e-kreta.hu/sso' 
  WHEN 'KK' THEN 'https://esl-kk.e-kreta.hu/sso'
  WHEN 'NSZFH' THEN 'https://esl-nszfh.e-kreta.hu/sso'
  WHEN 'NSZFH-EMA' THEN 'https://esl-nszfh-ema.e-kreta.hu/sso'
END

DECLARE @fokuszUrl nvarchar(255) = CASE @EnvironmentName
  WHEN 'AZURE' THEN 'https://fokusz-ema.e-kreta.hu/sso'
  WHEN 'HOI' THEN 'https://fokusz-hoi.e-kreta.hu/sso' 
  WHEN 'KK' THEN 'https://fokusz-kk.e-kreta.hu/sso'
  WHEN 'NSZFH' THEN 'https://fokusz-nszfh.e-kreta.hu/sso'
  WHEN 'NSZFH-EMA' THEN 'https://fokusz-nszfh-ema.e-kreta.hu/sso'
END

DECLARE @eslIsEnabled nvarchar(255) = CASE WHEN @EnvironmentName IN ('AZURE','HOI','KK','NSZFH','NSZFH_EMA') THEN 'true' ELSE 'false' END
DECLARE @fokuszIsEnabled nvarchar(255) = CASE WHEN @EnvironmentName IN ('HOI','KK','NSZFH') THEN 'true' ELSE 'false' END
DECLARE @hrModulIsEnabled nvarchar(255) = CASE WHEN @EnvironmentName IN ('KK') THEN 'true' ELSE 'false' END
​
INSERT INTO T_INTEZMENYCONFIG ([C_ERTEK], [C_CONFIGTIPUSID], [C_INTEZMENYID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
	SELECT @eslIsEnabled, 1, i.ID, 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL FROM T_INTEZMENY i WHERE i.TOROLT = 'F'

INSERT INTO T_INTEZMENYCONFIG ([C_ERTEK], [C_CONFIGTIPUSID], [C_INTEZMENYID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
	SELECT @eslUrl, 2, i.ID, 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL FROM T_INTEZMENY i WHERE i.TOROLT = 'F'

INSERT INTO T_INTEZMENYCONFIG ([C_ERTEK], [C_CONFIGTIPUSID], [C_INTEZMENYID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
	SELECT @fokuszIsEnabled, 3, i.ID, 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL FROM T_INTEZMENY i WHERE i.TOROLT = 'F'
​
INSERT INTO T_INTEZMENYCONFIG ([C_ERTEK], [C_CONFIGTIPUSID], [C_INTEZMENYID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
	SELECT @fokuszUrl, 4, i.ID, 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL FROM T_INTEZMENY i WHERE i.TOROLT = 'F'

INSERT INTO T_INTEZMENYCONFIG ([C_ERTEK], [C_CONFIGTIPUSID], [C_INTEZMENYID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID])
	SELECT @hrModulIsEnabled, 5, i.ID, 'F', 0, GETDATE(), GETDATE(), 0, 0, NULL FROM T_INTEZMENY i WHERE i.TOROLT = 'F'
