using System;

namespace Adaptation.Shared;

public class Logistics2 : Methods.ILogistics2
{

    public string MID { get; private set; }
    public string RunNumber { get; private set; }
    public string SatelliteGroup { get; private set; }
    public string PartNumber { get; private set; }
    public string PocketNumber { get; private set; }
    public string WaferLot { get; private set; }
    public string Recipe { get; private set; }

    public Logistics2(string logistics2)
    {
        string key;
        string[] segments;
        key = "JOBID=";
        if (!logistics2.Contains(key))
            MID = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            MID = segments[1].Split(';')[0];
        }
        key = "MID=";
        if (!logistics2.Contains(key))
            RunNumber = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            RunNumber = segments[1].Split(';')[0];
        }
        key = "INFO=";
        if (!logistics2.Contains(key))
            SatelliteGroup = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            SatelliteGroup = segments[1].Split(';')[0];
        }
        key = "PRODUCT=";
        if (!logistics2.Contains(key))
            PartNumber = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            PartNumber = segments[1].Split(';')[0];
        }
        key = "CHAMBER=";
        if (!logistics2.Contains(key))
            PocketNumber = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            PocketNumber = segments[1].Split(';')[0];
        }
        key = "WAFER_ID=";
        if (!logistics2.Contains(key))
            WaferLot = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            WaferLot = segments[1].Split(';')[0];
        }
        key = "PPID=";
        if (!logistics2.Contains(key))
            Recipe = "null";
        else
        {
            segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
            Recipe = segments[1].Split(';')[0];
        }
    }

}