package com.utopiaindustries.qualitychecker.utils;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

@JsonIgnoreProperties( ignoreUnknown = true )
@JsonNaming( PropertyNamingStrategy.SnakeCaseStrategy.class )
public class Release {
	private String id;
	private String tagName;
	private String name;
	private List<ReleaseAsset> assets;

	public Release() {
	}

	public String getId() {
		return id;
	}

	public void setId( String id ) {
		this.id = id;
	}

	public String getTagName() {
		return tagName;
	}

	public void setTagName( String tagName ) {
		this.tagName = tagName;
	}

	public String getName() {
		return name;
	}

	public void setName( String name ) {
		this.name = name;
	}

	public List<ReleaseAsset> getAssets() {
		return assets;
	}

	public void setAssets( List<ReleaseAsset> assets ) {
		this.assets = assets;
	}

	public String getDownloadUrl() {
		if ( this.assets == null || this.assets.isEmpty() ) {
			return null;
		}
		return this.assets.get( 0 ).getBrowserDownloadUrl();
	}

	@Override
	public String toString() {
		return "Release{" +
				"id='" + id + '\'' +
				", tagName='" + tagName + '\'' +
				", name='" + name + '\'' +
				", assets=" + assets +
				'}';
	}
}
