using StoryEngine.Core.Filters;
using StoryEngine.Core.Filters.Values;
using StoryEngine.Core.HistoryPoints;
using StoryEngine.Core.Modifiers;
using System.Collections.ObjectModel;

namespace StoryEngine.Core.Sample
{
    public static class SampleStory
    {
        public static History Create()
            => new History
            {
                Name = "Sample story",
                CurrentPointId = "p1",
                Points = new ObservableCollection<HistoryPointBase>
            {
                new TextPoint
                {
                    Id = "p1",
                    Text = "You are at point 1. Select next point:",
                    NextPossiblePoints = new ObservableCollection<string>() { "p2", "p3" },
                    Filters = new ObservableCollection<FilterBase>
                    {
                        new EqualFilter
                        {
                            Left = new VariableValue { Value = "NextPoint" },
                            Right = new ConstValue { Value = 1}
                        }
                    },
                    Variants = new ObservableCollection<HistoryVariant>
                    {
                        new HistoryVariant
                        {
                            Text = "Go to point 2.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 2
                                }
                            }
                        },
                        new HistoryVariant
                        {
                            Text = "Go to point 3.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 3
                                }
                            }
                        }
                    }
                },
                new TextPoint
                {
                    Id = "p2",
                    Text = "You are at point 2. Select next point:",
                    NextPossiblePoints = new ObservableCollection<string>() { "p1", "p3" },
                    Filters = new ObservableCollection<FilterBase>
                    {
                        new EqualFilter
                        {
                            Left = new VariableValue { Value = "NextPoint" },
                            Right = new ConstValue { Value = 2}
                        }
                    },
                    Variants = new ObservableCollection<HistoryVariant>
                    {
                        new HistoryVariant
                        {
                            Text = "Go to point 1.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 1
                                }
                            }
                        },
                        new HistoryVariant
                        {
                            Text = "Go to point 3.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 3
                                }
                            }
                        }
                    }
                },
                new TextPoint
                {
                    Id = "p3",
                    Text = "You are at point 3. Select next point:",
                    NextPossiblePoints = new ObservableCollection<string>() { "p1", "p2" },
                    Filters = new ObservableCollection<FilterBase>
                    {
                        new EqualFilter
                        {
                            Left = new VariableValue { Value = "NextPoint" },
                            Right = new ConstValue { Value = 3}
                        }
                    },
                    Variants = new ObservableCollection<HistoryVariant>
                    {
                        new HistoryVariant
                        {
                            Text = "Go to point 1.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 1
                                }
                            }
                        },
                        new HistoryVariant
                        {
                            Text = "Go to point 2.",
                            Modifiers = new ObservableCollection<ModifierBase>
                            {
                                new SetModifier
                                {
                                    VariableName = "NextPoint",
                                    Value = 2
                                }
                            }
                        }
                    }
                }
            }
            };
    }
}