// Path: src/main/java/com/mpalourdio/springboottemplate/json/Account.java
// public class Account implements AccountInterface {
// 
//     public String firstName;
//     public String lastName;
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/AccountDecorator.java
// public class AccountDecorator implements AccountInterface {
// 
//     @JsonUnwrapped
//     public Account account;
//     public Context context;
// 
//     public AccountDecorator() {
//     }
// 
//     public AccountDecorator(Account account) {
//         this.account = account;
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/AccountInterface.java
// public interface AccountInterface {
// 
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/Context.java
// public class Context {
// 
//     public String ref;
// 
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/mediatype/MediaType.java
// public final class MediaType extends org.springframework.http.MediaType {
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V1;
//     public static final String APPLICATION_VND_API_V1_VALUE = "application/vnd.api.v1+json;charset=UTF-8";
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V2;
//     public static final String APPLICATION_VND_API_V2_VALUE = "application/vnd.api.v2+json;charset=UTF-8";
// 
//     private MediaType(String type) {
//         super(type);
//     }
// 
//     static {
//         var applicationType = "application";
//         APPLICATION_VND_API_V1 = new org.springframework.http.MediaType(applicationType, "vnd.api.v1+json", StandardCharsets.UTF_8);
//         APPLICATION_VND_API_V2 = new org.springframework.http.MediaType(applicationType, "vnd.api.v2+json", StandardCharsets.UTF_8);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/properties/CredentialsProperties.java
// @Getter
// @AllArgsConstructor
// @ConstructorBinding
// @ConfigurationProperties("admin")
// public class CredentialsProperties {
// 
//     private final String username;
//     private final String password;
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/service/ToSerialize.java
// public class ToSerialize implements Cloneable {
// 
//     public String prop1;
//     public String prop2;
// 
//     @Override
//     public ToSerialize clone() throws CloneNotSupportedException {
//         return (ToSerialize) super.clone();
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/service/UselessBean.java
// @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
// public class UselessBean {
// 
//     private String testPro = "inclass";
// 
//     private final ABeanIWantToMockInterface aBeanIWantToMock;
// 
//     public UselessBean(ABeanIWantToMockInterface aBeanIWantToMock) {
//         this.aBeanIWantToMock = aBeanIWantToMock;
//     }
// 
//     public Boolean iWantToMockThisMethod() {
//         return aBeanIWantToMock.iAlwaysReturnFalse();
//     }
// 
//     public String getTestPro() {
//         return testPro;
//     }
// 
//     public void setTestPro(String testPro) {
//         this.testPro = testPro;
//     }
// 
//     public void testSerialization(ToSerialize toSerialize) {
//         toSerialize.prop1 = "prop1updated";
//     }
// }


import com.mpalourdio.springboottemplate.json.Account;
import com.mpalourdio.springboottemplate.json.AccountDecorator;
import com.mpalourdio.springboottemplate.json.AccountInterface;
import com.mpalourdio.springboottemplate.json.Context;
import com.mpalourdio.springboottemplate.mediatype.MediaType;
import com.mpalourdio.springboottemplate.properties.CredentialsProperties;
import com.mpalourdio.springboottemplate.service.ToSerialize;
import com.mpalourdio.springboottemplate.service.UselessBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
    private final CredentialsProperties credentialsProperties;
    private final UselessBean uselessBean;

    public MiscController(
            @Value("${server.port}") String serverPort,
            @Value("${list}") String[] propertiesList,
            CredentialsProperties credentialsProperties,
            UselessBean uselessBean
    ) {
        this.serverPort = serverPort;
        this.propertiesList = propertiesList;
        this.credentialsProperties = credentialsProperties;
        this.uselessBean = uselessBean;
    }

    @GetMapping("/basicauth")
    public String restTemplateWithBasicAuth() {
        var rt = new RestTemplateBuilder()
                .basicAuthentication(credentialsProperties.getUsername(), credentialsProperties.getPassword()).build();
        return rt.getForObject("http://localhost:" + serverPort + "/basicauth", String.class);
    }

    @PostMapping(value = "/serialization", produces = MediaType.APPLICATION_JSON_VALUE)
    public ToSerialize testSerialization(@RequestBody ToSerialize toSerialize) {
        uselessBean.testSerialization(toSerialize);

        return toSerialize;
    }

    @PostMapping(value = "/jsonunwrapped", produces = MediaType.APPLICATION_JSON_VALUE)
// Path: src/main/java/com/mpalourdio/springboottemplate/json/Account.java
// public class Account implements AccountInterface {
// 
//     public String firstName;
//     public String lastName;
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/AccountDecorator.java
// public class AccountDecorator implements AccountInterface {
// 
//     @JsonUnwrapped
//     public Account account;
//     public Context context;
// 
//     public AccountDecorator() {
//     }
// 
//     public AccountDecorator(Account account) {
//         this.account = account;
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/AccountInterface.java
// public interface AccountInterface {
// 
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/json/Context.java
// public class Context {
// 
//     public String ref;
// 
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/mediatype/MediaType.java
// public final class MediaType extends org.springframework.http.MediaType {
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V1;
//     public static final String APPLICATION_VND_API_V1_VALUE = "application/vnd.api.v1+json;charset=UTF-8";
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V2;
//     public static final String APPLICATION_VND_API_V2_VALUE = "application/vnd.api.v2+json;charset=UTF-8";
// 
//     private MediaType(String type) {
//         super(type);
//     }
// 
//     static {
//         var applicationType = "application";
//         APPLICATION_VND_API_V1 = new org.springframework.http.MediaType(applicationType, "vnd.api.v1+json", StandardCharsets.UTF_8);
//         APPLICATION_VND_API_V2 = new org.springframework.http.MediaType(applicationType, "vnd.api.v2+json", StandardCharsets.UTF_8);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/properties/CredentialsProperties.java
// @Getter
// @AllArgsConstructor
// @ConstructorBinding
// @ConfigurationProperties("admin")
// public class CredentialsProperties {
// 
//     private final String username;
//     private final String password;
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/service/ToSerialize.java
// public class ToSerialize implements Cloneable {
// 
//     public String prop1;
//     public String prop2;
// 
//     @Override
//     public ToSerialize clone() throws CloneNotSupportedException {
//         return (ToSerialize) super.clone();
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/service/UselessBean.java
// @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
// public class UselessBean {
// 
//     private String testPro = "inclass";
// 
//     private final ABeanIWantToMockInterface aBeanIWantToMock;
// 
//     public UselessBean(ABeanIWantToMockInterface aBeanIWantToMock) {
//         this.aBeanIWantToMock = aBeanIWantToMock;
//     }
// 
//     public Boolean iWantToMockThisMethod() {
//         return aBeanIWantToMock.iAlwaysReturnFalse();
//     }
// 
//     public String getTestPro() {
//         return testPro;
//     }
// 
//     public void setTestPro(String testPro) {
//         this.testPro = testPro;
//     }
// 
//     public void testSerialization(ToSerialize toSerialize) {
//         toSerialize.prop1 = "prop1updated";
//     }
// }


// Path: src/main/java/com/mpalourdio/springboottemplate/controllers/MiscController.java
import com.mpalourdio.springboottemplate.json.Account;
import com.mpalourdio.springboottemplate.json.AccountDecorator;
import com.mpalourdio.springboottemplate.json.AccountInterface;
import com.mpalourdio.springboottemplate.json.Context;
import com.mpalourdio.springboottemplate.mediatype.MediaType;
import com.mpalourdio.springboottemplate.properties.CredentialsProperties;
import com.mpalourdio.springboottemplate.service.ToSerialize;
import com.mpalourdio.springboottemplate.service.UselessBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

    private final CredentialsProperties credentialsProperties;
    private final UselessBean uselessBean;

    public MiscController(
            @Value("${server.port}") String serverPort,
            @Value("${list}") String[] propertiesList,
            CredentialsProperties credentialsProperties,
            UselessBean uselessBean
    ) {
        this.serverPort = serverPort;
        this.propertiesList = propertiesList;
        this.credentialsProperties = credentialsProperties;
        this.uselessBean = uselessBean;
    }

    @GetMapping("/basicauth")
    public String restTemplateWithBasicAuth() {
        var rt = new RestTemplateBuilder()
                .basicAuthentication(credentialsProperties.getUsername(), credentialsProperties.getPassword()).build();
        return rt.getForObject("http://localhost:" + serverPort + "/basicauth", String.class);
    }

    @PostMapping(value = "/serialization", produces = MediaType.APPLICATION_JSON_VALUE)
    public ToSerialize testSerialization(@RequestBody ToSerialize toSerialize) {
        uselessBean.testSerialization(toSerialize);

        return toSerialize;
    }

    @PostMapping(value = "/jsonunwrapped", produces = MediaType.APPLICATION_JSON_VALUE)
    public AccountInterface jsonUnwrapped(@RequestBody Account account) {