package io.swagger.model.core;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.model.BrAPIResponseResult;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Validated
public class CommonCropListResponseResult implements BrAPIResponseResult<CommonCrop> {

    @JsonProperty("data")
    @Valid
    private List<CommonCrop> data = new ArrayList<>();

    public CommonCropListResponseResult data(List<CommonCrop> data) {
        this.data = data;
        return this;
    }

    public CommonCropListResponseResult addDataItem(CommonCrop dataItem) {
        this.data.add(dataItem);
        return this;
    }

    @ApiModelProperty(required = true, value = "Crop mutation results")
    @Valid
    public List<CommonCrop> getData() {
        return data;
    }

    public void setData(List<CommonCrop> data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CommonCropListResponseResult that = (CommonCropListResponseResult) o;
        return Objects.equals(data, that.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(data);
    }
}
