package com.bytedance.ies.xelement.defaultimpl.player.engine.api.common;

import X.2HN;
import X.AnonymousClass8YN;
import X.AnonymousClass8YO;
import X.AnonymousClass8YQ;
import X.C22158Yc;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.google.gson.a.c;
import com.google.gson.m;
import java.util.Objects;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class PlayModel {
    @c(LIZ = "type")
    public final String encryptType;
    @c(LIZ = "quality")
    public final String quality;
    @c(LIZ = "video_model")
    public final m videoModelJsonObj;

    static {
        Covode.recordClassIndex(32315);
    }

    public PlayModel() {
        this((String) null, (String) null, (m) null, 7, (2HN) null);
    }

    public static /* synthetic */ PlayModel copy$default(PlayModel playModel, String str, String str2, m mVar, int i, Object obj) {
        if ((i & 1) != 0) {
            str = playModel.quality;
        }
        if ((i & 2) != 0) {
            str2 = playModel.encryptType;
        }
        if ((i & 4) != 0) {
            mVar = playModel.videoModelJsonObj;
        }
        return playModel.copy(str, str2, mVar);
    }

    private Object[] getObjects() {
        return new Object[]{this.quality, this.encryptType, this.videoModelJsonObj};
    }

    public final PlayModel copy(String str, String str2, m mVar) {
        return new PlayModel(str, str2, mVar);
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof PlayModel)) {
            return false;
        }
        return M12.LIZ(((PlayModel) obj).getObjects(), getObjects());
    }

    public final int hashCode() {
        return Objects.hash(getObjects());
    }

    public final String toString() {
        return M12.LIZ("PlayModel:%s,%s,%s", getObjects());
    }

    public final String getEncryptType() {
        return this.encryptType;
    }

    public final String getQuality() {
        return this.quality;
    }

    public final m getVideoModelJsonObj() {
        return this.videoModelJsonObj;
    }

    public final AnonymousClass8YQ getVideoModel() {
        m mVar = this.videoModelJsonObj;
        if (mVar != null) {
            return makeVideoModel(mVar);
        }
        return null;
    }

    public final AnonymousClass8YN getResolution() {
        String str = this.quality;
        if (n.LIZ((Object) str, (Object) C22158Yc.EXCELLENT.getDesc())) {
            return AnonymousClass8YN.SuperHigh;
        }
        if (n.LIZ((Object) str, (Object) C22158Yc.GOOD.getDesc())) {
            return AnonymousClass8YN.H_High;
        }
        n.LIZ((Object) str, (Object) C22158Yc.REGULAR.getDesc());
        return AnonymousClass8YN.Standard;
    }

    private final boolean isValid(AnonymousClass8YO r3) {
        if (r3.LJIJJLI == 10) {
            return true;
        }
        return false;
    }

    private final AnonymousClass8YQ makeVideoModel(m mVar) {
        try {
            AnonymousClass8YQ r3 = new AnonymousClass8YQ();
            AnonymousClass8YO r2 = new AnonymousClass8YO();
            r2.LIZ(new JSONObject(mVar.toString()));
            if (!isValid(r2)) {
                return null;
            }
            r3.LIZ(r2);
            return r3;
        } catch (Throwable unused) {
            return null;
        }
    }

    public PlayModel(String str, String str2, m mVar) {
        this.quality = str;
        this.encryptType = str2;
        this.videoModelJsonObj = mVar;
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public /* synthetic */ PlayModel(String str, String str2, m mVar, int i, 2HN r7) {
        this((i & 1) != 0 ? "" : str, (i & 2) != 0 ? "" : str2, (i & 4) != 0 ? null : mVar);
    }
}
