// Path: eva-release/src/main/java/uk/ac/ebi/eva/release/models/ReleaseInfo.java
// @Entity
// @Table(name = "release_rs")
// public class ReleaseInfo {
// 
//     @Id
//     private int releaseVersion;
// 
//     private LocalDateTime releaseDate;
// 
//     private String releaseDescription;
// 
//     private String releaseFtp;
// 
//     public ReleaseInfo() {
//     }
// 
//     public int getReleaseVersion() {
//         return releaseVersion;
//     }
// 
//     public void setReleaseVersion(int releaseVersion) {
//         this.releaseVersion = releaseVersion;
//     }
// 
//     public LocalDateTime getReleaseDate() {
//         return releaseDate;
//     }
// 
//     public void setReleaseDate(LocalDateTime releaseDate) {
//         this.releaseDate = releaseDate;
//     }
// 
//     public String getReleaseDescription() {
//         return releaseDescription;
//     }
// 
//     public void setReleaseDescription(String releaseDescription) {
//         this.releaseDescription = releaseDescription;
//     }
// 
//     public String getReleaseFtp() {
//         return releaseFtp;
//     }
// 
//     public void setReleaseFtp(String releaseFtp) {
//         this.releaseFtp = releaseFtp;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
//         ReleaseInfo that = (ReleaseInfo) o;
//         return releaseVersion == that.releaseVersion &&
//                 Objects.equals(releaseDate, that.releaseDate) &&
//                 Objects.equals(releaseDescription, that.releaseDescription) &&
//                 Objects.equals(releaseFtp, that.releaseFtp);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(releaseVersion, releaseDate, releaseDescription, releaseFtp);
//     }
// 
//     @Override
//     public String toString() {
//         return "ReleaseInfo{" +
//                 "releaseVersion=" + releaseVersion +
//                 ", releaseDate=" + releaseDate +
//                 ", releaseDescription='" + releaseDescription + '\'' +
//                 ", releaseFtp='" + releaseFtp + '\'' +
//                 '}';
//     }
// }
// 
// Path: eva-release/src/main/java/uk/ac/ebi/eva/release/repositories/ReleaseInfoRepository.java
// @Repository
// public interface ReleaseInfoRepository extends CrudRepository<ReleaseInfo, Integer> {
// 
//     Optional<ReleaseInfo> findFirstByOrderByReleaseDateDesc();
// }


import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import uk.ac.ebi.eva.release.models.ReleaseInfo;
import uk.ac.ebi.eva.release.repositories.ReleaseInfoRepository;
import javax.websocket.server.PathParam;
import java.util.Collections;
/*
 * Copyright 2020 EMBL - European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.ac.ebi.eva.release.controllers;




@RestController
@RequestMapping(value = "/v1/info", produces = "application/json")
@Api(tags = {"RS Release Info"})
public class ReleaseInfoController {

    private final ReleaseInfoRepository releaseInfoRepository;

    public ReleaseInfoController(ReleaseInfoRepository releaseInfoRepository) {
        this.releaseInfoRepository = releaseInfoRepository;
    }

    @GetMapping
    public Iterable<ReleaseInfo> getReleaseInfo(
            @RequestParam(name = "releaseVersion", required = false) Integer releaseVersion) {
        if (releaseVersion != null) {
            return Collections.singleton(releaseInfoRepository.findById(releaseVersion).get());
        } else {
// Path: eva-release/src/main/java/uk/ac/ebi/eva/release/models/ReleaseInfo.java
// @Entity
// @Table(name = "release_rs")
// public class ReleaseInfo {
// 
//     @Id
//     private int releaseVersion;
// 
//     private LocalDateTime releaseDate;
// 
//     private String releaseDescription;
// 
//     private String releaseFtp;
// 
//     public ReleaseInfo() {
//     }
// 
//     public int getReleaseVersion() {
//         return releaseVersion;
//     }
// 
//     public void setReleaseVersion(int releaseVersion) {
//         this.releaseVersion = releaseVersion;
//     }
// 
//     public LocalDateTime getReleaseDate() {
//         return releaseDate;
//     }
// 
//     public void setReleaseDate(LocalDateTime releaseDate) {
//         this.releaseDate = releaseDate;
//     }
// 
//     public String getReleaseDescription() {
//         return releaseDescription;
//     }
// 
//     public void setReleaseDescription(String releaseDescription) {
//         this.releaseDescription = releaseDescription;
//     }
// 
//     public String getReleaseFtp() {
//         return releaseFtp;
//     }
// 
//     public void setReleaseFtp(String releaseFtp) {
//         this.releaseFtp = releaseFtp;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
//         ReleaseInfo that = (ReleaseInfo) o;
//         return releaseVersion == that.releaseVersion &&
//                 Objects.equals(releaseDate, that.releaseDate) &&
//                 Objects.equals(releaseDescription, that.releaseDescription) &&
//                 Objects.equals(releaseFtp, that.releaseFtp);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(releaseVersion, releaseDate, releaseDescription, releaseFtp);
//     }
// 
//     @Override
//     public String toString() {
//         return "ReleaseInfo{" +
//                 "releaseVersion=" + releaseVersion +
//                 ", releaseDate=" + releaseDate +
//                 ", releaseDescription='" + releaseDescription + '\'' +
//                 ", releaseFtp='" + releaseFtp + '\'' +
//                 '}';
//     }
// }
// 
// Path: eva-release/src/main/java/uk/ac/ebi/eva/release/repositories/ReleaseInfoRepository.java
// @Repository
// public interface ReleaseInfoRepository extends CrudRepository<ReleaseInfo, Integer> {
// 
//     Optional<ReleaseInfo> findFirstByOrderByReleaseDateDesc();
// }


// Path: eva-release/src/main/java/uk/ac/ebi/eva/release/controllers/ReleaseInfoController.java
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import uk.ac.ebi.eva.release.models.ReleaseInfo;
import uk.ac.ebi.eva.release.repositories.ReleaseInfoRepository;
import javax.websocket.server.PathParam;
import java.util.Collections;

/*
 * Copyright 2020 EMBL - European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.ac.ebi.eva.release.controllers;




@RestController
@RequestMapping(value = "/v1/info", produces = "application/json")
@Api(tags = {"RS Release Info"})
public class ReleaseInfoController {

    private final ReleaseInfoRepository releaseInfoRepository;

    public ReleaseInfoController(ReleaseInfoRepository releaseInfoRepository) {
        this.releaseInfoRepository = releaseInfoRepository;
    }

    @GetMapping
    public Iterable<ReleaseInfo> getReleaseInfo(
            @RequestParam(name = "releaseVersion", required = false) Integer releaseVersion) {
        if (releaseVersion != null) {
            return Collections.singleton(releaseInfoRepository.findById(releaseVersion).get());
        } else {
            return releaseInfoRepository.findAll();