package in.gov.digilocker.uidai.services.properties;

import java.io.InputStream;
import java.util.Properties;

import org.springframework.stereotype.Service;

@Service
public class DemoAuthProperties {
	
	private String matchSchemaName;
	private String matchSchemaVal;
	
	private String demoAuthXmlns;
	private String demoAuthVersion;	
	
	private String tid;
	private String ac;
	private String sa;
	private String lk;
	private String udc;
	
	public DemoAuthProperties() {
		Properties props = new java.util.Properties();		
	    try {
	      InputStream uidaiInputStream = getClass().getClassLoader().getResourceAsStream("uidai-services.properties");
	      props.load(uidaiInputStream);
	    }catch (Exception e) {
	      throw new RuntimeException(e.getMessage());
	    }
	    this.matchSchemaName = props.getProperty("uidai.demo.auth.match.schema.name");
	    this.matchSchemaVal = props.getProperty("uidai.demo.auth.match.schema.value");
	    this.demoAuthXmlns= (null!= props.getProperty("uidai.demo.auth.xmlns")) && !("".equals(props.getProperty("uidai.demo.auth.xmlns"))) ? props.getProperty("uidai.demo.auth.xmlns") : "";
	    this.demoAuthVersion= (null!= props.getProperty("uidai.demo.auth.version")) && !("".equals( props.getProperty("uidai.demo.auth.version"))) ?  props.getProperty("uidai.request.auth.ver") : ""; 
	    
	    this.tid= (null!= props.getProperty("uidai.demo.auth.tid.value")) && !("".equals(props.getProperty("uidai.demo.auth.tid.value"))) ? props.getProperty("uidai.demo.auth.tid.value") : "";
	    this.ac= (null!= props.getProperty("uidai.request.otp.ac")) && !("".equals(props.getProperty("uidai.request.otp.ac"))) ? props.getProperty("uidai.request.otp.ac") : "";
	    this.sa= (null!= props.getProperty("uidai.request.otp.sa")) && !("".equals(props.getProperty("uidai.request.otp.sa"))) ? props.getProperty("uidai.request.otp.sa") : "";
	    this.lk= (null!= props.getProperty("uidai.request.otp.lk")) && !("".equals(props.getProperty("uidai.request.otp.lk"))) ? props.getProperty("uidai.request.otp.lk") : "";
	    
	    this.udc= (null!=props.getProperty("uidai.auth.meta.udc.value")) && !("".equals(props.getProperty("uidai.auth.meta.udc.value")))?props.getProperty("uidai.auth.meta.udc.value"): "";
	}

	public String getMatchSchemaName() {
		return matchSchemaName;
	}

	public String getMatchSchemaVal() {
		return matchSchemaVal;
	}

	public String getDemoAuthXmlns() {
		return demoAuthXmlns;
	}

	public String getDemoAuthVersion() {
		return demoAuthVersion;
	}

	public String getTid() {
		return tid;
	}

	public String getAc() {
		return ac;
	}

	public String getSa() {
		return sa;
	}

	public String getLk() {
		return lk;
	}

	public String getUdc() {
		return udc;
	}
}
