package com.ss.android.ugc.aweme.story.edit.model;

import X.C032359l;
import X.C25245yM;
import X.M12;
import android.os.Parcel;
import android.os.Parcelable;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.creative.CreativeInfo;
import com.ss.android.ugc.aweme.story.base.model.EditContext;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public final class StoryEditModel implements Parcelable, C032359l<StoryEditClipModel>, Serializable {
    public static final C25245yM CREATOR = new C25245yM((byte) 0);
    public ArrayList<StoryEditClipModel> _clips;
    public final CreativeInfo creativeInfo;
    public final EditContext editContext;
    public final boolean isMultiContent;
    public final int origin;
    public final String shootWay;

    static {
        Covode.recordClassIndex(117580);
    }

    public final int describeContents() {
        return 0;
    }

    public final List<StoryEditClipModel> getClips() {
        return this._clips;
    }

    public final CreativeInfo getCreativeInfo() {
        return this.creativeInfo;
    }

    public final EditContext getEditContext() {
        return this.editContext;
    }

    public final int getOrigin() {
        return this.origin;
    }

    public final String getShootWay() {
        return this.shootWay;
    }

    public final boolean isMultiContent() {
        return this.isMultiContent;
    }

    public final void clear() {
        this._clips.clear();
    }

    public final String getCreationId() {
        return this.creativeInfo.getCreationId();
    }

    public final boolean remove(StoryEditClipModel storyEditClipModel) {
        M12.LIZ(storyEditClipModel);
        return this._clips.remove(storyEditClipModel);
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public StoryEditModel(android.os.Parcel r9) {
        /*
            r8 = this;
            X.M12.LIZ(r9)
            java.lang.Class<com.ss.android.ugc.aweme.creative.CreativeInfo> r0 = com.ss.android.ugc.aweme.creative.CreativeInfo.class
            java.lang.ClassLoader r0 = r0.getClassLoader()
            android.os.Parcelable r2 = r9.readParcelable(r0)
            com.ss.android.ugc.aweme.creative.CreativeInfo r2 = (com.ss.android.ugc.aweme.creative.CreativeInfo) r2
            if (r2 != 0) goto L_0x001b
            com.ss.android.ugc.aweme.creative.CreativeInfo r2 = new com.ss.android.ugc.aweme.creative.CreativeInfo
            r3 = 0
            r4 = 0
            r5 = 0
            r6 = 7
            r7 = 0
            r2.<init>(r3, r4, r5, r6, r7)
        L_0x001b:
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r2, r0)
            java.lang.String r3 = r9.readString()
            if (r3 != 0) goto L_0x0029
            kotlin.h.b.n.LIZIZ()
        L_0x0029:
            kotlin.h.b.n.LIZIZ(r3, r0)
            int r4 = r9.readInt()
            byte r1 = r9.readByte()
            r0 = 1
            if (r1 != r0) goto L_0x005a
            r5 = 1
        L_0x0038:
            java.lang.Class<com.ss.android.ugc.aweme.story.base.model.EditContext> r0 = com.ss.android.ugc.aweme.story.base.model.EditContext.class
            java.lang.ClassLoader r0 = r0.getClassLoader()
            android.os.Parcelable r6 = r9.readParcelable(r0)
            com.ss.android.ugc.aweme.story.base.model.EditContext r6 = (com.ss.android.ugc.aweme.story.base.model.EditContext) r6
            r1 = r8
            r1.<init>(r2, r3, r4, r5, r6)
            java.lang.Class<com.ss.android.ugc.aweme.story.edit.model.StoryEditClipModel> r0 = com.ss.android.ugc.aweme.story.edit.model.StoryEditClipModel.class
            java.lang.ClassLoader r0 = r0.getClassLoader()
            java.util.ArrayList r1 = r9.readArrayList(r0)
            java.lang.String r0 = "null cannot be cast to non-null type kotlin.collections.ArrayList<com.ss.android.ugc.aweme.story.edit.model.StoryEditClipModel> /* = java.util.ArrayList<com.ss.android.ugc.aweme.story.edit.model.StoryEditClipModel> */"
            java.util.Objects.requireNonNull(r1, r0)
            r8._clips = r1
            return
        L_0x005a:
            r0 = 0
            r5 = 0
            goto L_0x0038
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.story.edit.model.StoryEditModel.<init>(android.os.Parcel):void");
    }

    public final void add(StoryEditClipModel storyEditClipModel, int i) {
        boolean z;
        M12.LIZ(storyEditClipModel);
        if (this.origin == 0) {
            z = true;
        } else {
            z = false;
        }
        storyEditClipModel.setFastImport(z);
        if (i < 0 || i > this._clips.size()) {
            this._clips.add(storyEditClipModel);
        } else {
            this._clips.add(i, storyEditClipModel);
        }
    }

    public final void swap(StoryEditClipModel storyEditClipModel, StoryEditClipModel storyEditClipModel2) {
        M12.LIZ(storyEditClipModel, storyEditClipModel2);
        ArrayList<StoryEditClipModel> arrayList = this._clips;
        int indexOf = arrayList.indexOf(storyEditClipModel);
        int indexOf2 = this._clips.indexOf(storyEditClipModel2);
        M12.LIZ(arrayList);
        if (indexOf != indexOf2 && indexOf >= 0 && indexOf2 >= 0 && indexOf <= arrayList.size() - 1 && indexOf2 <= arrayList.size() - 1) {
            StoryEditClipModel storyEditClipModel3 = arrayList.get(indexOf);
            arrayList.set(indexOf, arrayList.get(indexOf2));
            arrayList.set(indexOf2, storyEditClipModel3);
        }
    }

    public final void writeToParcel(Parcel parcel, int i) {
        M12.LIZ(parcel);
        parcel.writeParcelable(this.creativeInfo, i);
        parcel.writeString(this.shootWay);
        parcel.writeInt(this.origin);
        parcel.writeByte(this.isMultiContent ? (byte) 1 : 0);
        parcel.writeParcelable(this.editContext, i);
        parcel.writeList(getClips());
    }

    public StoryEditModel(CreativeInfo creativeInfo2, String str, int i, boolean z, EditContext editContext2) {
        M12.LIZ(creativeInfo2, str);
        this.creativeInfo = creativeInfo2;
        this.shootWay = str;
        this.origin = i;
        this.isMultiContent = z;
        this.editContext = editContext2;
        this._clips = new ArrayList<>();
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public /* synthetic */ StoryEditModel(com.ss.android.ugc.aweme.creative.CreativeInfo r9, java.lang.String r10, int r11, boolean r12, com.ss.android.ugc.aweme.story.base.model.EditContext r13, int r14, X.2HN r15) {
        /*
            r8 = this;
            r1 = r9
            r7 = r13
            r0 = r14 & 1
            if (r0 == 0) goto L_0x0010
            com.ss.android.ugc.aweme.creative.CreativeInfo r1 = new com.ss.android.ugc.aweme.creative.CreativeInfo
            r2 = 0
            r3 = 0
            r4 = 0
            r5 = 7
            r6 = 0
            r1.<init>(r2, r3, r4, r5, r6)
        L_0x0010:
            r0 = r14 & 16
            if (r0 == 0) goto L_0x0015
            r7 = 0
        L_0x0015:
            r2 = r8
            r5 = r11
            r4 = r10
            r6 = r12
            r3 = r1
            r2.<init>(r3, r4, r5, r6, r7)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.story.edit.model.StoryEditModel.<init>(com.ss.android.ugc.aweme.creative.CreativeInfo, java.lang.String, int, boolean, com.ss.android.ugc.aweme.story.base.model.EditContext, int, X.2HN):void");
    }
}
