%!TEX root = ../pmdraw.tex

% *------------------------------*
% |8````````````````````````````7|
% |`````____````____`````````````|
% |````|MFMF\  /MFMF|````````````|
% |````|MF|MF\/MF|MF|````````````|
% |````|MF|\MFMF/|MF|_______`````|
% |````|MF|``````|MFMFMFMFMF|````|
% |````|MF|``````|MF|````````````|
% |````|MF|``````|MF|___`````````|
% |``````````````|MFMFMF|````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |7````````````````````````````3|
% *------------------------------*

\usetikzlibrary{patterns}

\newcommand{\blockStyles}{
    \tikzstyle{typeI} = [
        very thick,
        rounded corners=5pt,
        red,
        preaction={fill, red!3}
    ]
    \tikzstyle{typeT} = [
        very thick,
        rounded corners=5pt,
        dash pattern={on 7.5pt off 2.5pt},
        green,
        preaction={fill, green!3}
    ]
    \tikzstyle{typeB} = [
        very thick,
        rounded corners=5pt,
        dash pattern={on 2.5pt off 2.5pt},
        blue,
        preaction={fill, blue!3}
    ]
    \tikzstyle{typeO} = [
        very thick,
        rounded corners=5pt,
        dash pattern={on 2.5pt off 2.5pt on 7.5pt off 2.5pt},
        orange,
        preaction={fill, orange!3}
    ]
    \tikzstyle{typeU} = [
        very thick,
        rounded corners=5pt,
        dash pattern={on 2.5pt off 2.5pt on 2.5pt off 2.5pt on 7.5pt off 2.5pt},
        violet,
        preaction={fill, violet!3}
    ]
    \tikzstyle{typeN} = [
        very thick,
        rounded corners=5pt,
        dash pattern={on 7.5pt off 2.5pt on 7.5pt off 2.5pt on 2.5pt off 2.5pt},
        yellow,
        preaction={fill, yellow!3}
    ]
}

\pmdProduct[ % Options
    decorate before={
        \blockStyles
        \draw[typeO] (0.6, -1.9) rectangle (4.4, 0.7);
        \foreach \x in {0,2} {
            \begin{scope}[shift={(\x,0)}]
                \draw[typeB] (0.6, -3.4) rectangle (2.4, -2.3);
                \draw[typeT] (0.6, 1.3) rectangle (2.4, 2.4);
            \end{scope}
        }
    }
]{ % Added edges
    {1}{4}
}{ % Top Diagram
    { % Brick 1
        [ % Options
            degree=4
        ]{ % Upper non transversal edges
            {1}{2}
            {3}{4}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
        }{ % Transversal edges
            \pmdEmpty
        }
    }
}{ % Bottom Diagram
    { % Brick 1
        [ % Options
            degree=4,
            levels top=2
        ]{ % Upper non transversal edges
            [level=2]{1}{4}
            {2}{3}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
        }{ % Transversal edges
            \pmdEmpty
        }
    }
}
\hspace{5em}
\pmdProduct[ % Options
    decorate before={
        \blockStyles
        \draw[typeO] (0.6, -1.9) rectangle (11.4, 0.7);
        \foreach \x in {0,2,4,7,9} {
            \begin{scope}[shift={(\x,0)}]
                \draw[typeB] (0.6, -3.4) rectangle (2.4, -2.3);
                \draw[typeT] (0.6, 1.3) rectangle (2.4, 2.4);
            \end{scope}
        }
    }
]{ % Added edges
    {1}{5}
    {9}{11}
}{ % Top Diagram
    { % Brick 1
        [ % Options
            degree=6
        ]{ % Upper non transversal edges
            {1}{2}
            {3}{4}
            {5}{6}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
            {5}{6}
        }{ % Transversal edges
            \pmdEmpty
        }
    }{ % Brick 2
        [ % Options
            degree=4
        ]{ % Upper non transversal edges
            {1}{2}
            {3}{4}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
        }{ % Transversal edges
            \pmdEmpty
        }
    }
}{ % Bottom Diagram
    { % Brick 1
        [ % Options
            degree top=5,
            levels top=2,
            degree bottom=6
        ]{ % Upper non transversal edges
            [level=2]{1}{11}
            {2}{3}
            {4}{5}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
            {5}{6}
        }{ % Transversal edges
            \pmdEmpty
        }
    }{ % Brick 2
        [ % Options
            blank top=1,
            degree top=3,
            degree bottom=4,
            levels top=2
        ]{ % Upper non transversal edges
            {2}{3}
        }{ % Lower non transversal edges
            {1}{2}
            {3}{4}
        }{ % Transversal edges
            \pmdEmpty
        }
    }
}