package com.amplifyframework.datastore.appsync;

import com.amplifyframework.core.model.Model;
import java.util.Objects;
import s3.d;

/* loaded from: classes4.dex */
public final class ModelWithMetadata<M extends Model> {
    private final M model;
    private final ModelMetadata syncMetadata;

    public ModelWithMetadata(M m10, ModelMetadata modelMetadata) {
        Objects.requireNonNull(m10);
        this.model = m10;
        Objects.requireNonNull(modelMetadata);
        this.syncMetadata = new ModelMetadata(m10.getModelName() + "|" + m10.getPrimaryKeyString(), modelMetadata.isDeleted(), modelMetadata.getVersion(), modelMetadata.getLastChangedAt());
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || ModelWithMetadata.class != obj.getClass()) {
            return false;
        }
        ModelWithMetadata modelWithMetadata = (ModelWithMetadata) obj;
        if (d.a(this.model, modelWithMetadata.model)) {
            return d.a(this.syncMetadata, modelWithMetadata.syncMetadata);
        }
        return false;
    }

    public M getModel() {
        return this.model;
    }

    public ModelMetadata getSyncMetadata() {
        return this.syncMetadata;
    }

    public int hashCode() {
        M m10 = this.model;
        int hashCode = (m10 != null ? m10.hashCode() : 0) * 31;
        ModelMetadata modelMetadata = this.syncMetadata;
        return hashCode + (modelMetadata != null ? modelMetadata.hashCode() : 0);
    }

    public String toString() {
        return "ModelWithMetadata{model=" + this.model + ", syncMetadata=" + this.syncMetadata + '}';
    }
}
