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

import X.M12;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.ArrayList;
import java.util.List;

public final class UserStoryKt {
    static {
        Covode.recordClassIndex(79088);
    }

    public static final Integer currentIndex(UserStory userStory) {
        M12.LIZ(userStory);
        UserStoryCurrentInfo currentInfo = userStory.getCurrentInfo();
        if (currentInfo != null) {
            return currentInfo.getCurrentIndex();
        }
        return null;
    }

    public static final Aweme currentStory(UserStory userStory) {
        M12.LIZ(userStory);
        UserStoryCurrentInfo currentInfo = userStory.getCurrentInfo();
        if (currentInfo != null) {
            return currentInfo.getCurrentStory();
        }
        return null;
    }

    public static final UserStory copyAll(UserStory userStory) {
        UserStory userStory2 = userStory;
        M12.LIZ(userStory2);
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(userStory2.getStories());
        UserStoryCurrentInfo currentInfo = userStory2.getCurrentInfo();
        UserStoryCurrentInfo userStoryCurrentInfo = null;
        if (currentInfo != null) {
            userStoryCurrentInfo = UserStoryCurrentInfo.copy$default(currentInfo, (Integer) null, (Aweme) null, 3, (Object) null);
        }
        return UserStory.copy$default(userStory2, arrayList, 0, 0, false, 0, 0, false, false, 0, false, 0, userStoryCurrentInfo, false, false, 14334, (Object) null);
    }

    public static final UserStory copyUserStory(UserStory userStory) {
        UserStory userStory2 = userStory;
        if (userStory2 == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(userStory2.getStories());
        return UserStory.copy$default(userStory2, arrayList, 0, 0, false, 0, 0, false, false, 0, false, 0, (UserStoryCurrentInfo) null, false, false, 16382, (Object) null);
    }

    public static final UserStory update(UserStory userStory, UserStory userStory2) {
        M12.LIZ(userStory);
        if (userStory2 == null) {
            return userStory;
        }
        List<Aweme> stories = userStory.getStories();
        stories.clear();
        stories.addAll(userStory2.getStories());
        userStory.setTotalCount(userStory2.getTotalCount());
        userStory.setCurrentPosition(userStory2.getCurrentPosition());
        userStory.setAllViewed(userStory2.getAllViewed());
        userStory.setMinCursor(userStory2.getMinCursor());
        userStory.setMaxCursor(userStory2.getMaxCursor());
        userStory.setHasMoreAfter(userStory2.getHasMoreBefore());
        userStory.setHasMoreBefore(userStory2.getHasMoreBefore());
        userStory.setLastStoryCreatedAt(userStory2.getLastStoryCreatedAt());
        UserStoryCurrentInfo currentInfo = userStory2.getCurrentInfo();
        UserStoryCurrentInfo userStoryCurrentInfo = null;
        if (currentInfo != null) {
            userStoryCurrentInfo = UserStoryCurrentInfo.copy$default(currentInfo, (Integer) null, (Aweme) null, 3, (Object) null);
        }
        userStory.setCurrentInfo(userStoryCurrentInfo);
        return userStory;
    }
}
