package io.cattle.platform.iaas.api.auth.integration.azure;

import io.github.ibuildthecloud.gdapi.annotation.Field;
import io.github.ibuildthecloud.gdapi.annotation.Type;


@Type(name = AzureConstants.CONFIG)
public class AzureConfig {
    private Boolean enabled;
    private String tenantId;    
    private String clientId;
    private String accessMode;  
    private String domain;  
    private String adminAccountUsername;
    private String adminAccountPassword;

    public AzureConfig(Boolean enabled, String accessMode, String tenantId, String clientId, 
            String domain, String adminAccountUsername, String adminAccountPassword) {
        this.enabled = enabled;
        this.tenantId = tenantId;
        this.clientId = clientId;
        this.accessMode = accessMode;
        this.domain = domain;
        this.adminAccountUsername = adminAccountUsername;
        this.adminAccountPassword = adminAccountPassword;
    }

    @Field(required = true, nullable = false, defaultValue = "unrestricted")
    public String getAccessMode() {
        return accessMode;
    }
    
    @Field(nullable = true)
    public Boolean getEnabled() {
        return enabled;
    }

    @Field(nullable = true)
    public String getClientId() {
        return clientId;
    }

    @Field(nullable = true)
    public String getTenantId() {
        return tenantId;
    }

    public String getName() {
        return AzureConstants.CONFIG;
    }
    
    @Field(nullable = true)
    public String getDomain() {
        return domain;
    }   
    
    @Field(nullable = true, required = true, minLength = 1)
    public String getAdminAccountUsername() {
        return adminAccountUsername;
    }

    @Field(nullable = true, required = true, minLength = 1)
    public String getAdminAccountPassword() {
        return adminAccountPassword;
    }    

}

@@ -379,24 +379,140 @@
 g domain;  %0A
+    //Admin credential fields are not really used for any functionality by Azure provider, keeping it as 'optional'%0A
     private 
@@ -1658,24 +1658,126 @@
   %7D   %0A    %0A
+    //this field is not really used for any functionality by Azure provider, keeping it as 'optional'%0A
     @Field(n
@@ -1795,35 +1795,36 @@
 rue, required = 
-tru
+fals
 e, minLength = 1
@@ -1906,32 +1906,133 @@
 Username;%0A    %7D%0A
+    //this field is not really used for any functionality by Azure provider, keeping it as 'optional'
 %0A    @Field(null
@@ -2055,19 +2055,20 @@
 uired = 
-tru
+fals
 e, minLe
@@ -2165,16 +2165,12 @@
 d;%0A    %7D
-    
 %0A%0A%7D%0A

Make Azure admin credential fields optional