using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;

public class ModelList
{
    public static readonly List<BaseModel> BaseModels = new List<BaseModel>()
    {
        new BaseModel(
    "Fahrrad", "bike", 
        Resources.Load<Mesh>("Bicycle/Models/Low-Poly Bicycle # 5"),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        new List<Port>
            { //please dont ask about the numbers
                new Port(Definitions.PORT_BIKE_SPROCKET, new Vector3(0.007933f,0.444f,-0.1614f), "idBikeSprocket"),
                new Port(Definitions.PORT_BIKE_PEDAL_L, new Vector3(-0.1252177f,0.5490288f,-0.312027f), "idBikePedalL_1"),
                new Port(Definitions.PORT_BIKE_PEDAL_R, new Vector3(0.1410843f,0.3393247f, -0.01154391f), "idBikePedalR_1"),
                new Port(Definitions.PORT_BIKE_STEER, new Vector3(0.002989591f,1.214713f,0.4860705f), Quaternion.Euler(-30f,0f,0f),  "idBikeHandlebars"),
                new Port(Definitions.PORT_BIKE_WHEEL, new Vector3(-0.01431298f,0.4673222f,-0.7874681f), "idBikeWheel_Back1"),
                new Port(Definitions.PORT_BIKE_WHEEL, new Vector3(0.01984263f,0.4673225f,0.9462124f), "idBikeWheel_Front1"),
                new Port(Definitions.PORT_BIKE_DRIVER, new Vector3(0f,1.25f,-0.65f), Quaternion.Euler(70f,0f,0f),  "nuke"),
            }
        )
    };
    public static readonly List<ChildModel> ChildModels = new List<ChildModel>()
    {
        new ChildModel(
        "driver", "Bacteria", "bacteria", 
        Resources.Load<Mesh>("Plagues/Mesh/bacteria"),
        new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        null
        ),
        new ChildModel(
        "driver", "ICBM", "nuke", 
        Resources.Load<Mesh>("Plagues/Mesh/Nuke"), 
        new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        null
        ),
        new ChildModel(
        Definitions.PORT_BIKE_WHEEL, "30 Zoller MehrSpeicherFelge", "bike30inchAlloy", 
        Resources.Load<Mesh>("Plagues/Mesh/Hex"), 
        new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        null
        ),
        new ChildModel(
        "bikePedalR", "Pedal Rechts", "bikePedalR", 
        Resources.Load<Mesh>("Plagues/Mesh/Hex"), 
        new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        null
        ),
        new ChildModel(
        "bikePedalL", "Pedal Links", "bikePedalL", 
        Resources.Load<Mesh>("Plagues/Mesh/Hex"), 
        new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        null
        )
    };
    
    static ModelList()
    {
        // i love importing .fbx, maybe refactor this function some day
        ChildModels.AddRange(ModelLoader.LoadChildModels(
        new string[6] // port
        {
            Definitions.PORT_BIKE_SPROCKET,
            Definitions.PORT_BIKE_PEDAL_L,
            Definitions.PORT_BIKE_PEDAL_R,
            Definitions.PORT_BIKE_STEER,
            Definitions.PORT_BIKE_WHEEL,
            Definitions.PORT_BIKE_WHEEL,
        },
        new string[6] //human name
        {
            "Sprocket",
            "Left Pedal",
            "Right Pedal",
            "Handlebars",
            "Back Wheel",
            "Front Wheel",
        },
        new string[6] //id
        {
            "idBikeSprocket",
            "idBikePedalL_1",
            "idBikePedalR_1",
            "idBikeHandlebars",
            "idBikeWheel_Back1",
            "idBikeWheel_Front1",
        },
        Resources.LoadAll<Mesh>("Bicycle/Models/Low-Poly Bicycle # 5"),
        new Material[6] //mat
        {
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
            new Material(Shader.Find("VR/SpatialMapping/Occlusion")),
        },
        new List<Port>[6] // ports
        {
            null,
            null,
            null,
            null,
            null,
            null,
        },
        1 //skip the first mesh, which is the basemodel
        ));
    }
}