%!TEX root = ../pmdraw.tex

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                        %
% Licence                                                %
%                                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Copyright 2023-10-16 (original release) -- 2025, Matthias Fresacher
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is found via
% http://www.latex-project.org/lppl.txt.

\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
        }
    }
}
