from .primitives import (
    identity,
    rotate_90,
    rotate_180,
    rotate_270,
    flip_horizontal,
    flip_vertical,
    flip_diagonal,
    flip_antidiagonal,
)
from .._utils import RewriteRule


rule_set = {
    RewriteRule(identity, rotate_90, rotate_90),
    RewriteRule(identity, rotate_180, rotate_180),
    RewriteRule(identity, rotate_270, rotate_270),
    RewriteRule(identity, flip_horizontal, flip_horizontal),
    RewriteRule(identity, flip_vertical, flip_vertical),
    RewriteRule(identity, flip_diagonal, flip_diagonal),
    RewriteRule(identity, flip_antidiagonal, flip_antidiagonal),
    #
    RewriteRule(rotate_90, identity, rotate_90),
    RewriteRule(rotate_90, rotate_90, rotate_180),
    RewriteRule(rotate_90, rotate_180, rotate_270),
    RewriteRule(rotate_90, rotate_270, identity),
    RewriteRule(rotate_90, flip_horizontal, flip_antidiagonal),
    RewriteRule(rotate_90, flip_vertical, flip_diagonal),
    RewriteRule(rotate_90, flip_diagonal, flip_horizontal),
    RewriteRule(rotate_90, flip_antidiagonal, flip_vertical),
    #
    RewriteRule(rotate_180, identity, rotate_180),
    RewriteRule(rotate_180, rotate_90, rotate_270),
    RewriteRule(rotate_180, rotate_180, identity),
    RewriteRule(rotate_180, rotate_270, rotate_90),
    RewriteRule(rotate_180, flip_horizontal, flip_vertical),
    RewriteRule(rotate_180, flip_vertical, flip_horizontal),
    RewriteRule(rotate_180, flip_diagonal, flip_antidiagonal),
    RewriteRule(rotate_180, flip_antidiagonal, flip_diagonal),
    #
    RewriteRule(rotate_270, identity, rotate_270),
    RewriteRule(rotate_270, rotate_90, identity),
    RewriteRule(rotate_270, rotate_180, rotate_90),
    RewriteRule(rotate_270, rotate_270, rotate_180),
    RewriteRule(rotate_270, flip_horizontal, flip_diagonal),
    RewriteRule(rotate_270, flip_vertical, flip_antidiagonal),
    RewriteRule(rotate_270, flip_diagonal, flip_vertical),
    RewriteRule(rotate_270, flip_antidiagonal, flip_horizontal),
    #
    RewriteRule(flip_horizontal, identity, flip_horizontal),
    RewriteRule(flip_horizontal, rotate_90, flip_diagonal),
    RewriteRule(flip_horizontal, rotate_180, flip_vertical),
    RewriteRule(flip_horizontal, rotate_270, flip_antidiagonal),
    RewriteRule(flip_horizontal, flip_horizontal, identity),
    RewriteRule(flip_horizontal, flip_vertical, rotate_180),
    RewriteRule(flip_horizontal, flip_diagonal, rotate_90),
    RewriteRule(flip_horizontal, flip_antidiagonal, rotate_270),
    #
    RewriteRule(flip_vertical, identity, flip_vertical),
    RewriteRule(flip_vertical, rotate_90, flip_antidiagonal),
    RewriteRule(flip_vertical, rotate_180, flip_horizontal),
    RewriteRule(flip_vertical, rotate_270, flip_diagonal),
    RewriteRule(flip_vertical, flip_horizontal, rotate_180),
    RewriteRule(flip_vertical, flip_vertical, identity),
    RewriteRule(flip_vertical, flip_diagonal, rotate_270),
    RewriteRule(flip_vertical, flip_antidiagonal, rotate_90),
    #
    RewriteRule(flip_diagonal, identity, flip_diagonal),
    RewriteRule(flip_diagonal, rotate_90, flip_vertical),
    RewriteRule(flip_diagonal, rotate_180, flip_antidiagonal),
    RewriteRule(flip_diagonal, rotate_270, flip_horizontal),
    RewriteRule(flip_diagonal, flip_horizontal, rotate_270),
    RewriteRule(flip_diagonal, flip_vertical, rotate_90),
    RewriteRule(flip_diagonal, flip_diagonal, identity),
    RewriteRule(flip_diagonal, flip_antidiagonal, rotate_180),
    #
    RewriteRule(flip_antidiagonal, identity, flip_antidiagonal),
    RewriteRule(flip_antidiagonal, rotate_90, flip_horizontal),
    RewriteRule(flip_antidiagonal, rotate_180, flip_diagonal),
    RewriteRule(flip_antidiagonal, rotate_270, flip_vertical),
    RewriteRule(flip_antidiagonal, flip_horizontal, rotate_90),
    RewriteRule(flip_antidiagonal, flip_vertical, rotate_270),
    RewriteRule(flip_antidiagonal, flip_diagonal, rotate_180),
    RewriteRule(flip_antidiagonal, flip_antidiagonal, identity),
}
