package io.renren.modules.kubesphere.module.request;


import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author chenrj
 * @email 1412736935@qq.com
 * @since 2021/7/29
 */
@Data
public class S2iBuildersRequest extends KubeSphereRequest implements Serializable {
    @SerializedName("apiVersion")
    private String apiVersion;
    @SerializedName("kind")
    private String kind;
    @SerializedName("metadata")
    private S2iBuildersRequest.MetadataDTO metadata;
    @SerializedName("spec")
    private S2iBuildersRequest.SpecDTO spec;

    @Data
    public static class MetadataDTO implements Serializable {
        @SerializedName("labels")
        private S2iBuildersRequest.MetadataDTO.LabelsDTO labels;
        @SerializedName("annotations")
        private S2iBuildersRequest.MetadataDTO.AnnotationsDTO annotations;
        @SerializedName("name")
        private String name;
        @SerializedName("namespace")
        private String namespace;

        @Data
        public static class LabelsDTO implements Serializable {
            @SerializedName("controller-tools.k8s.io")
            private String _$ControllerToolsK8sIo275; // FIXME check this code
            @SerializedName("s2i-type.kubesphere.io")
            private String _$S2iTypeKubesphereIo20; // FIXME check this code
        }

        @Data
        public static class AnnotationsDTO implements Serializable {
            @SerializedName("languageType")
            private String languageType;
            @SerializedName("kubesphere.io/repoUrl")
            private String _$KubesphereIoRepoUrl111; // FIXME check this code
            @SerializedName("kubesphere.io/file")
            private String _$KubesphereIoFile212; // FIXME check this code
            @SerializedName("kubesphere.io/creator")
            private String _$KubesphereIoCreator15; // FIXME check this code
        }
    }

    @Data
    public static class SpecDTO implements Serializable {
        @SerializedName("config")
        private S2iBuildersRequest.SpecDTO.ConfigDTO config;

        @Data
        public static class ConfigDTO implements Serializable {
            @SerializedName("replicas")
            private Integer replicas;
            @SerializedName("export")
            private Boolean export;
            @SerializedName("outputBuildResult")
            private Boolean outputBuildResult;
            @SerializedName("builderPullPolicy")
            private String builderPullPolicy;
            @SerializedName("isBinaryURL")
            private Boolean isBinaryURL;
            @SerializedName("tag")
            private String tag;
            @SerializedName("builderImage")
            private String builderImage;
            @SerializedName("runtimeImage")
            private String runtimeImage;
            @SerializedName("type")
            private String type;
            @SerializedName("imageName")
            private String imageName;
            @SerializedName("pushAuthentication")
            private S2iBuildersRequest.SpecDTO.ConfigDTO.PushAuthenticationDTO pushAuthentication;
            @SerializedName("sourceUrl")
            private String sourceUrl;
            @SerializedName("buildVolumes")
            private List<String> buildVolumes;
            @SerializedName("runtimeArtifacts")
            private List<S2iBuildersRequest.SpecDTO.ConfigDTO.RuntimeArtifactsDTO> runtimeArtifacts;

            @Data
            public static class PushAuthenticationDTO implements Serializable {
                @SerializedName("secretRef")
                private S2iBuildersRequest.SpecDTO.ConfigDTO.PushAuthenticationDTO.SecretRefDTO secretRef;

                @Data
                public static class SecretRefDTO implements Serializable {
                    @SerializedName("name")
                    private String name;
                }
            }

            @Data
            public static class RuntimeArtifactsDTO implements Serializable {
                @SerializedName("source")
                private String source;
            }
        }
    }
}
