using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using UnityEngine;

[Serializable]
public class SceneSerializable : ObjectContainerSerializable
{
    public string Version;
    public string Date;
    public TimelineControllerSerializable Timeline;
    public List<ObjectContainerSerializable> Objects = new List<ObjectContainerSerializable>();

    public SceneSerializable() { }

    public SceneSerializable(SceneContainer scene)
    {
        this.Version = Application.version;
        this.Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture); ;
        this.Timeline = new TimelineControllerSerializable(TimelineController.Instance);
        this.Frames = scene.Frames.Select(f => new FrameContent(f)).ToList();
        foreach (var obj in scene.AllObjects)
        {
            if (obj != scene)
                Objects.Add(obj.Serialize());
        }
    }
}
