// Path: src/main/java/com/hantsylabs/restexample/springmvc/domain/User.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// @Entity
// @Table(name = "users")
// public class User implements UserDetails, Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     @Id()
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "username")
//     private String username;
// 
//     @Column(name = "password")
//     private String password;
// 
//     @Column(name = "name")
//     private String name;
// 
//     @Column(name = "email")
//     private String email;
// 
//     @Column(name = "role")
//     private String role;
// 
//     @Column(name = "created_date")
//     @CreatedDate
//     private LocalDateTime createdDate;
// 
//     public String getName() {
//         if (this.name == null || this.name.trim().length() == 0) {
//             return this.username;
//         }
//         return name;
//     }
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return Arrays.asList(new SimpleGrantedAuthority("ROLE_" + this.role));
//     }
// 
//     @Override
//     public String getPassword() {
//         return this.password;
//     }
// 
//     @Override
//     public String getUsername() {
//         return this.username;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
// 
//     public boolean isEnabled() {
//         return true;
//     }
// 
// 
// }


import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.hantsylabs.restexample.springmvc.domain.User;
import java.time.LocalDateTime;
import java.util.ArrayList;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.AuthorizationScopeBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.BasicAuth;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
package com.hantsylabs.restexample.springmvc;


@Configuration
@EnableSwagger2
//@Profile(value = {"dev", "test", "staging"})// Loads the spring beans required by the framework
@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig {

    @Bean
    public Docket userApi() {
        AuthorizationScope[] authScopes = new AuthorizationScope[1];
        authScopes[0] = new AuthorizationScopeBuilder()
                .scope("read")
                .description("read access")
                .build();
        SecurityReference securityReference = SecurityReference.builder()
                .reference("test")
                .scopes(authScopes)
                .build();
        ArrayList<SecurityContext> securityContexts = Lists.newArrayList(
                SecurityContext.builder()
                        .securityReferences(Lists.newArrayList(securityReference))
                        .build()
        );
        return new Docket(DocumentationType.SWAGGER_2)
                .directModelSubstitute(LocalDateTime.class, String.class)
// Path: src/main/java/com/hantsylabs/restexample/springmvc/domain/User.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// @Entity
// @Table(name = "users")
// public class User implements UserDetails, Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     @Id()
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "username")
//     private String username;
// 
//     @Column(name = "password")
//     private String password;
// 
//     @Column(name = "name")
//     private String name;
// 
//     @Column(name = "email")
//     private String email;
// 
//     @Column(name = "role")
//     private String role;
// 
//     @Column(name = "created_date")
//     @CreatedDate
//     private LocalDateTime createdDate;
// 
//     public String getName() {
//         if (this.name == null || this.name.trim().length() == 0) {
//             return this.username;
//         }
//         return name;
//     }
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return Arrays.asList(new SimpleGrantedAuthority("ROLE_" + this.role));
//     }
// 
//     @Override
//     public String getPassword() {
//         return this.password;
//     }
// 
//     @Override
//     public String getUsername() {
//         return this.username;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
// 
//     public boolean isEnabled() {
//         return true;
//     }
// 
// 
// }


// Path: src/main/java/com/hantsylabs/restexample/springmvc/SwaggerConfig.java
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.hantsylabs.restexample.springmvc.domain.User;
import java.time.LocalDateTime;
import java.util.ArrayList;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.AuthorizationScopeBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.BasicAuth;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

package com.hantsylabs.restexample.springmvc;


@Configuration
@EnableSwagger2
//@Profile(value = {"dev", "test", "staging"})// Loads the spring beans required by the framework
@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig {

    @Bean
    public Docket userApi() {
        AuthorizationScope[] authScopes = new AuthorizationScope[1];
        authScopes[0] = new AuthorizationScopeBuilder()
                .scope("read")
                .description("read access")
                .build();
        SecurityReference securityReference = SecurityReference.builder()
                .reference("test")
                .scopes(authScopes)
                .build();
        ArrayList<SecurityContext> securityContexts = Lists.newArrayList(
                SecurityContext.builder()
                        .securityReferences(Lists.newArrayList(securityReference))
                        .build()
        );
        return new Docket(DocumentationType.SWAGGER_2)
                .directModelSubstitute(LocalDateTime.class, String.class)
                .ignoredParameterTypes(User.class)