
using Microsoft.Xna.Framework;
using Monocle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Celeste.Mod.Eevee_Skinmod {
    public class SkinPalette {
        public List<Color> ears1 { get; set; }
        public List<Color> ears2 { get; set; }
        public List<Color> ears3 { get; set; }
        public List<Color> hair { get; set; }
        public List<Color> fluff1 { get; set; }
        public List<Color> fluff2 { get; set; }
        public List<Color> tail1 { get; set; }
        public List<Color> tail2 { get; set; }
        public List<Color> tail3 { get; set; }
        public List<Color> eyes { get; set; }
        public List<Color> face1 { get; set; }
        public List<Color> face2 { get; set; }
        public List<Color> frontPaw1 { get; set; }
        public List<Color> frontPaw2 { get; set; }
        public List<Color> backPaw1 { get; set; }
        public List<Color> backPaw2 { get; set; }
        public List<Color> frontPaw3 { get; set; }
        public List<Color> frontPaw4 { get; set; }
        public List<Color> backPaw3 { get; set; }
        public List<Color> backPaw4 { get; set; }
        public List<Color> body1 { get; set; }
        public List<Color> body2 { get; set; }
        public List<Color> tail4 { get; set; }
        public List<Color> tail5 { get; set; }
        public List<Color> body3 { get; set; }
        public List<Color> body4 { get; set; }
        public List<Color> dash { get; set; }
        public List<Color> outline { get; set; }
        public List<Color> mouth { get; set; }

        public static SkinPalette StringtoColor(Palette palette) {
            //The palette written in the .yaml file is in string, so we need to convert them to colors, originally the convertion was made in game each frame, but its so slowwww
            //now its made whenever the palette is changed, this was a later addition, so instead of remeaking everything i used this as a workaround
            SkinPalette fluff = new SkinPalette();
            fluff.ears1 = new List<Color>() { Calc.HexToColor(palette.ears1[0]), Calc.HexToColor(palette.ears1[1]), Calc.HexToColor(palette.ears1[2]), Calc.HexToColor(palette.ears1[3]), Calc.HexToColor(palette.ears1[4])};
            fluff.ears2 = new List<Color>() { Calc.HexToColor(palette.ears2[0]), Calc.HexToColor(palette.ears2[1]), Calc.HexToColor(palette.ears2[2]), Calc.HexToColor(palette.ears2[3]), Calc.HexToColor(palette.ears2[4]) };
            fluff.ears3 = new List<Color>() { Calc.HexToColor(palette.ears3[0]), Calc.HexToColor(palette.ears3[1]), Calc.HexToColor(palette.ears3[2]), Calc.HexToColor(palette.ears3[3]), Calc.HexToColor(palette.ears3[4]) };
            fluff.hair = new List<Color>() { Calc.HexToColor(palette.hair[0]), Calc.HexToColor(palette.hair[1]), Calc.HexToColor(palette.hair[2]), Calc.HexToColor(palette.hair[3]), Calc.HexToColor(palette.hair[4]) };
            fluff.fluff1 = new List<Color>() { Calc.HexToColor(palette.fluff1[0]), Calc.HexToColor(palette.fluff1[1]), Calc.HexToColor(palette.fluff1[2]), Calc.HexToColor(palette.fluff1[3]), Calc.HexToColor(palette.fluff1[4]) };
            fluff.fluff2 = new List<Color>() { Calc.HexToColor(palette.fluff2[0]), Calc.HexToColor(palette.fluff2[1]), Calc.HexToColor(palette.fluff2[2]), Calc.HexToColor(palette.fluff2[3]), Calc.HexToColor(palette.fluff2[4]) };
            fluff.tail1 = new List<Color>() { Calc.HexToColor(palette.tail1[0]), Calc.HexToColor(palette.tail1[1]), Calc.HexToColor(palette.tail1[2]), Calc.HexToColor(palette.tail1[3]), Calc.HexToColor(palette.tail1[4]) };
            fluff.tail2 = new List<Color>() { Calc.HexToColor(palette.tail2[0]), Calc.HexToColor(palette.tail2[1]), Calc.HexToColor(palette.tail2[2]), Calc.HexToColor(palette.tail2[3]), Calc.HexToColor(palette.tail2[4]) };
            fluff.tail3 = new List<Color>() { Calc.HexToColor(palette.tail3[0]), Calc.HexToColor(palette.tail3[1]), Calc.HexToColor(palette.tail3[2]), Calc.HexToColor(palette.tail3[3]), Calc.HexToColor(palette.tail3[4]) };
            fluff.eyes = new List<Color>() { Calc.HexToColor(palette.eyes[0]), Calc.HexToColor(palette.eyes[1]), Calc.HexToColor(palette.eyes[2]), Calc.HexToColor(palette.eyes[3]), Calc.HexToColor(palette.eyes[4]) };
            fluff.face1 = new List<Color>() { Calc.HexToColor(palette.face1[0]), Calc.HexToColor(palette.face1[1]), Calc.HexToColor(palette.face1[2]), Calc.HexToColor(palette.face1[3]), Calc.HexToColor(palette.face1[4]) };
            fluff.face2 = new List<Color>() { Calc.HexToColor(palette.face2[0]), Calc.HexToColor(palette.face2[1]), Calc.HexToColor(palette.face2[2]), Calc.HexToColor(palette.face2[3]), Calc.HexToColor(palette.face2[4]) };
            fluff.frontPaw1 = new List<Color>() { Calc.HexToColor(palette.frontPaw1[0]), Calc.HexToColor(palette.frontPaw1[1]), Calc.HexToColor(palette.frontPaw1[2]), Calc.HexToColor(palette.frontPaw1[3]), Calc.HexToColor(palette.frontPaw1[4]) };
            fluff.frontPaw2 = new List<Color>() { Calc.HexToColor(palette.FrontPaw2[0]), Calc.HexToColor(palette.FrontPaw2[1]), Calc.HexToColor(palette.FrontPaw2[2]), Calc.HexToColor(palette.FrontPaw2[3]), Calc.HexToColor(palette.FrontPaw2[4]) };
            fluff.backPaw1 = new List<Color>() { Calc.HexToColor(palette.backPaw1[0]), Calc.HexToColor(palette.backPaw1[1]), Calc.HexToColor(palette.backPaw1[2]), Calc.HexToColor(palette.backPaw1[3]), Calc.HexToColor(palette.backPaw1[4]) };
            fluff.backPaw2 = new List<Color>() { Calc.HexToColor(palette.backPaw2[0]), Calc.HexToColor(palette.backPaw2[1]), Calc.HexToColor(palette.backPaw2[2]), Calc.HexToColor(palette.backPaw2[3]), Calc.HexToColor(palette.backPaw2[4]) };
            fluff.frontPaw3 = new List<Color>() { Calc.HexToColor(palette.frontPaw3[0]), Calc.HexToColor(palette.frontPaw3[1]), Calc.HexToColor(palette.frontPaw3[2]), Calc.HexToColor(palette.frontPaw3[3]), Calc.HexToColor(palette.frontPaw3[4]) };
            fluff.frontPaw4 = new List<Color>() { Calc.HexToColor(palette.frontPaw4[0]), Calc.HexToColor(palette.frontPaw4[1]), Calc.HexToColor(palette.frontPaw4[2]), Calc.HexToColor(palette.frontPaw4[3]), Calc.HexToColor(palette.frontPaw4[4]) };
            fluff.backPaw3 = new List<Color>() { Calc.HexToColor(palette.backPaw3[0]), Calc.HexToColor(palette.backPaw3[1]), Calc.HexToColor(palette.backPaw3[2]), Calc.HexToColor(palette.backPaw3[3]), Calc.HexToColor(palette.backPaw3[4]) };
            fluff.backPaw4 = new List<Color>() { Calc.HexToColor(palette.backPaw4[0]), Calc.HexToColor(palette.backPaw4[1]), Calc.HexToColor(palette.backPaw4[2]), Calc.HexToColor(palette.backPaw4[3]), Calc.HexToColor(palette.backPaw4[4]) };
            fluff.body1 = new List<Color>() { Calc.HexToColor(palette.body1[0]), Calc.HexToColor(palette.body1[1]), Calc.HexToColor(palette.body1[2]), Calc.HexToColor(palette.body1[3]), Calc.HexToColor(palette.body1[4]) };
            fluff.body2 = new List<Color>() { Calc.HexToColor(palette.body2[0]), Calc.HexToColor(palette.body2[1]), Calc.HexToColor(palette.body2[2]), Calc.HexToColor(palette.body2[3]), Calc.HexToColor(palette.body2[4]) };
            fluff.tail4 = new List<Color>() { Calc.HexToColor(palette.tail4[0]), Calc.HexToColor(palette.tail4[1]), Calc.HexToColor(palette.tail4[2]), Calc.HexToColor(palette.tail4[3]), Calc.HexToColor(palette.tail4[4]) };
            fluff.tail5 = new List<Color>() { Calc.HexToColor(palette.tail5[0]), Calc.HexToColor(palette.tail5[1]), Calc.HexToColor(palette.tail5[2]), Calc.HexToColor(palette.tail5[3]), Calc.HexToColor(palette.tail5[4]) };
            fluff.body3 = new List<Color>() { Calc.HexToColor(palette.body3[0]), Calc.HexToColor(palette.body3[1]), Calc.HexToColor(palette.body3[2]), Calc.HexToColor(palette.body3[3]), Calc.HexToColor(palette.body3[4]) };
            fluff.body4 = new List<Color>() { Calc.HexToColor(palette.body4[0]), Calc.HexToColor(palette.body4[1]), Calc.HexToColor(palette.body4[2]), Calc.HexToColor(palette.body4[3]), Calc.HexToColor(palette.body4[4]) };
            fluff.dash = new List<Color>() { Calc.HexToColor(palette.dash[0]), Calc.HexToColor(palette.dash[1]), Calc.HexToColor(palette.dash[2]), Calc.HexToColor(palette.dash[3]), Calc.HexToColor(palette.dash[4]) };
            if (palette.outline != null) {
                fluff.outline = new List<Color>() { Calc.HexToColor(palette.outline[0]), Calc.HexToColor(palette.outline[1]), Calc.HexToColor(palette.outline[2]), Calc.HexToColor(palette.outline[3]), Calc.HexToColor(palette.outline[4]) };
            } else {
                fluff.outline = new List<Color>() { Color.Black, Color.Black, Color.Black, Color.Black, Color.Black };
            }
            if (palette.mouth != null) {
                fluff.mouth = new List<Color>() { Calc.HexToColor(palette.mouth[0]), Calc.HexToColor(palette.mouth[1]), Calc.HexToColor(palette.mouth[2]), Calc.HexToColor(palette.mouth[3]), Calc.HexToColor(palette.mouth[4]) };
            } else {
                fluff.mouth = new List<Color>() { Calc.HexToColor("#562023"), Calc.HexToColor("#562023"), Calc.HexToColor("#562023"), Calc.HexToColor("#562023"), Calc.HexToColor("#562023") };
            }
            return fluff;
        }
    }
}
