"""
transform_invariant_terms_rbd
=============================
Autogenerated DPF operator classes.
"""
from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import _Outputs
from ansys.dpf.core.operators.specification import PinSpecification, Specification


class transform_invariant_terms_rbd(Operator):
    """Transform invariant terms rbd based on a coordinate system
    (translation + rotation).

    Parameters
    ----------
    rotation_matrix : Field
        3-3 rotation matrix.
    coordinate_system : Field
        Origin of the new coordinate system.
    in_cms_rbd_file_path : str
        File name with cms_rbd extension where to
        read the input cms_rbd file.
    out_cms_rbd_file_path : str
        File name with cms_rbd extension where to
        create the new cms_rbd file.


    Examples
    --------
    >>> from ansys.dpf import core as dpf

    >>> # Instantiate operator
    >>> op = dpf.operators.geo.transform_invariant_terms_rbd()

    >>> # Make input connections
    >>> my_rotation_matrix = dpf.Field()
    >>> op.inputs.rotation_matrix.connect(my_rotation_matrix)
    >>> my_coordinate_system = dpf.Field()
    >>> op.inputs.coordinate_system.connect(my_coordinate_system)
    >>> my_in_cms_rbd_file_path = str()
    >>> op.inputs.in_cms_rbd_file_path.connect(my_in_cms_rbd_file_path)
    >>> my_out_cms_rbd_file_path = str()
    >>> op.inputs.out_cms_rbd_file_path.connect(my_out_cms_rbd_file_path)

    >>> # Instantiate operator and connect inputs in one line
    >>> op = dpf.operators.geo.transform_invariant_terms_rbd(
    ...     rotation_matrix=my_rotation_matrix,
    ...     coordinate_system=my_coordinate_system,
    ...     in_cms_rbd_file_path=my_in_cms_rbd_file_path,
    ...     out_cms_rbd_file_path=my_out_cms_rbd_file_path,
    ... )

    """

    def __init__(
        self,
        rotation_matrix=None,
        coordinate_system=None,
        in_cms_rbd_file_path=None,
        out_cms_rbd_file_path=None,
        config=None,
        server=None,
    ):
        super().__init__(
            name="transform_invariant_terms_rbd", config=config, server=server
        )
        self._inputs = InputsTransformInvariantTermsRbd(self)
        self._outputs = OutputsTransformInvariantTermsRbd(self)
        if rotation_matrix is not None:
            self.inputs.rotation_matrix.connect(rotation_matrix)
        if coordinate_system is not None:
            self.inputs.coordinate_system.connect(coordinate_system)
        if in_cms_rbd_file_path is not None:
            self.inputs.in_cms_rbd_file_path.connect(in_cms_rbd_file_path)
        if out_cms_rbd_file_path is not None:
            self.inputs.out_cms_rbd_file_path.connect(out_cms_rbd_file_path)

    @staticmethod
    def _spec():
        description = """Transform invariant terms rbd based on a coordinate system
            (translation + rotation)."""
        spec = Specification(
            description=description,
            map_input_pin_spec={
                0: PinSpecification(
                    name="rotation_matrix",
                    type_names=["field"],
                    optional=False,
                    document="""3-3 rotation matrix.""",
                ),
                1: PinSpecification(
                    name="coordinate_system",
                    type_names=["field"],
                    optional=False,
                    document="""Origin of the new coordinate system.""",
                ),
                2: PinSpecification(
                    name="in_cms_rbd_file_path",
                    type_names=["string"],
                    optional=False,
                    document="""File name with cms_rbd extension where to
        read the input cms_rbd file.""",
                ),
                3: PinSpecification(
                    name="out_cms_rbd_file_path",
                    type_names=["string"],
                    optional=False,
                    document="""File name with cms_rbd extension where to
        create the new cms_rbd file.""",
                ),
            },
            map_output_pin_spec={},
        )
        return spec

    @staticmethod
    def default_config(server=None):
        """Returns the default config of the operator.

        This config can then be changed to the user needs and be used to
        instantiate the operator. The Configuration allows to customize
        how the operation will be processed by the operator.

        Parameters
        ----------
        server : server.DPFServer, optional
            Server with channel connected to the remote or local instance. When
            ``None``, attempts to use the global server.
        """
        return Operator.default_config(
            name="transform_invariant_terms_rbd", server=server
        )

    @property
    def inputs(self):
        """Enables to connect inputs to the operator

        Returns
        --------
        inputs : InputsTransformInvariantTermsRbd
        """
        return super().inputs

    @property
    def outputs(self):
        """Enables to get outputs of the operator by evaluating it

        Returns
        --------
        outputs : OutputsTransformInvariantTermsRbd
        """
        return super().outputs


class InputsTransformInvariantTermsRbd(_Inputs):
    """Intermediate class used to connect user inputs to
    transform_invariant_terms_rbd operator.

    Examples
    --------
    >>> from ansys.dpf import core as dpf
    >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
    >>> my_rotation_matrix = dpf.Field()
    >>> op.inputs.rotation_matrix.connect(my_rotation_matrix)
    >>> my_coordinate_system = dpf.Field()
    >>> op.inputs.coordinate_system.connect(my_coordinate_system)
    >>> my_in_cms_rbd_file_path = str()
    >>> op.inputs.in_cms_rbd_file_path.connect(my_in_cms_rbd_file_path)
    >>> my_out_cms_rbd_file_path = str()
    >>> op.inputs.out_cms_rbd_file_path.connect(my_out_cms_rbd_file_path)
    """

    def __init__(self, op: Operator):
        super().__init__(transform_invariant_terms_rbd._spec().inputs, op)
        self._rotation_matrix = Input(
            transform_invariant_terms_rbd._spec().input_pin(0), 0, op, -1
        )
        self._inputs.append(self._rotation_matrix)
        self._coordinate_system = Input(
            transform_invariant_terms_rbd._spec().input_pin(1), 1, op, -1
        )
        self._inputs.append(self._coordinate_system)
        self._in_cms_rbd_file_path = Input(
            transform_invariant_terms_rbd._spec().input_pin(2), 2, op, -1
        )
        self._inputs.append(self._in_cms_rbd_file_path)
        self._out_cms_rbd_file_path = Input(
            transform_invariant_terms_rbd._spec().input_pin(3), 3, op, -1
        )
        self._inputs.append(self._out_cms_rbd_file_path)

    @property
    def rotation_matrix(self):
        """Allows to connect rotation_matrix input to the operator.

        3-3 rotation matrix.

        Parameters
        ----------
        my_rotation_matrix : Field

        Examples
        --------
        >>> from ansys.dpf import core as dpf
        >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
        >>> op.inputs.rotation_matrix.connect(my_rotation_matrix)
        >>> # or
        >>> op.inputs.rotation_matrix(my_rotation_matrix)
        """
        return self._rotation_matrix

    @property
    def coordinate_system(self):
        """Allows to connect coordinate_system input to the operator.

        Origin of the new coordinate system.

        Parameters
        ----------
        my_coordinate_system : Field

        Examples
        --------
        >>> from ansys.dpf import core as dpf
        >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
        >>> op.inputs.coordinate_system.connect(my_coordinate_system)
        >>> # or
        >>> op.inputs.coordinate_system(my_coordinate_system)
        """
        return self._coordinate_system

    @property
    def in_cms_rbd_file_path(self):
        """Allows to connect in_cms_rbd_file_path input to the operator.

        File name with cms_rbd extension where to
        read the input cms_rbd file.

        Parameters
        ----------
        my_in_cms_rbd_file_path : str

        Examples
        --------
        >>> from ansys.dpf import core as dpf
        >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
        >>> op.inputs.in_cms_rbd_file_path.connect(my_in_cms_rbd_file_path)
        >>> # or
        >>> op.inputs.in_cms_rbd_file_path(my_in_cms_rbd_file_path)
        """
        return self._in_cms_rbd_file_path

    @property
    def out_cms_rbd_file_path(self):
        """Allows to connect out_cms_rbd_file_path input to the operator.

        File name with cms_rbd extension where to
        create the new cms_rbd file.

        Parameters
        ----------
        my_out_cms_rbd_file_path : str

        Examples
        --------
        >>> from ansys.dpf import core as dpf
        >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
        >>> op.inputs.out_cms_rbd_file_path.connect(my_out_cms_rbd_file_path)
        >>> # or
        >>> op.inputs.out_cms_rbd_file_path(my_out_cms_rbd_file_path)
        """
        return self._out_cms_rbd_file_path


class OutputsTransformInvariantTermsRbd(_Outputs):
    """Intermediate class used to get outputs from
    transform_invariant_terms_rbd operator.

    Examples
    --------
    >>> from ansys.dpf import core as dpf
    >>> op = dpf.operators.geo.transform_invariant_terms_rbd()
    >>> # Connect inputs : op.inputs. ...
    """

    def __init__(self, op: Operator):
        super().__init__(transform_invariant_terms_rbd._spec().outputs, op)
