package com.ysoft.security.odc.dotnet;

import java.util.Objects;
import java.util.Optional;

public final class DAVulnerability {

    private final String title;
    private final String identifier;
    private final String description;
    private final String afectedVersions;
    private final String ossIndexId;
    private final String providedBy;
    private final Optional<String> optionalCve;

    public DAVulnerability(String title, String identifier, String description, String afectedVersions, String ossIndexId, String providedBy, Optional<String> optionalCve) {
        this.title = title;
        this.identifier = identifier;
        this.description = description;
        this.afectedVersions = afectedVersions;
        this.ossIndexId = ossIndexId;
        this.providedBy = providedBy;
        this.optionalCve = optionalCve;
    }

    public String getTitle() {
        return title;
    }

    public String getIdentifier() {
        return identifier;
    }

    public String getDescription() {
        return description;
    }

    public String getAfectedVersions() {
        return afectedVersions;
    }

    public String getOssIndexId() {
        return ossIndexId;
    }

    public String getProvidedBy() {
        return providedBy;
    }

    public Optional<String> getOptionalCve() {
        return optionalCve;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DAVulnerability that = (DAVulnerability) o;
        return Objects.equals(title, that.title) &&
                Objects.equals(identifier, that.identifier) &&
                Objects.equals(description, that.description) &&
                Objects.equals(afectedVersions, that.afectedVersions) &&
                Objects.equals(ossIndexId, that.ossIndexId) &&
                Objects.equals(providedBy, that.providedBy) &&
                Objects.equals(optionalCve, that.optionalCve);
    }

    @Override
    public int hashCode() {
        return Objects.hash(title, identifier, description, afectedVersions, ossIndexId, providedBy, optionalCve);
    }
}
