using System;
using Wizard.Story;

namespace Wizard;

public class StorySectionTask : BaseTask
{
	public class StorySectionTaskParam : BaseParam
	{
		public bool is_disp_first_tips;
	}

	public StorySectionTask(SelectedStoryInfo storyInfo)
	{
		base.type = GetApiType(storyInfo.StoryEntranceType);
	}

	private static ApiType.Type GetApiType(StoryEntranceType storyType)
	{
		return storyType switch
		{
			StoryEntranceType.AllStory => ApiType.Type.AllStorySection, 
			StoryEntranceType.MainStory => ApiType.Type.MainStorySection, 
			StoryEntranceType.LimitedStory => ApiType.Type.LimitedStorySection, 
			StoryEntranceType.EventStory => ApiType.Type.EventStorySection, 
			_ => throw new NotImplementedException(), 
		};
	}

	public void SetParameter(bool isDispFirstTips)
	{
		StorySectionTaskParam storySectionTaskParam = new StorySectionTaskParam();
		storySectionTaskParam.is_disp_first_tips = isDispFirstTips;
		base.Params = storySectionTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		Data.StoryWorldDataManager.SetData(base.ResponseData["data"]);
		return num;
	}
}
