# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""Module providing the ControlAcousticCoupling class."""
import typing
from ansys.dyna.core.lib.card import Card, Field, Flag
from ansys.dyna.core.lib.field_schema import FieldSchema
from ansys.dyna.core.lib.keyword_base import KeywordBase

_CONTROLACOUSTICCOUPLING_CARD0 = (
    FieldSchema("maccpl", int, 0, 10, 3),
    FieldSchema("acecf1", float, 10, 10, 1.5),
    FieldSchema("acecf2", float, 20, 10, 0.79),
    FieldSchema("acecf3", float, 30, 10, 0.5),
    FieldSchema("acecf4", float, 40, 10, 0.95),
)

class ControlAcousticCoupling(KeywordBase):
    """DYNA CONTROL_ACOUSTIC_COUPLING keyword"""

    keyword = "CONTROL"
    subkeyword = "ACOUSTIC_COUPLING"

    def __init__(self, **kwargs):
        """Initialize the ControlAcousticCoupling class."""
        super().__init__(**kwargs)
        self._cards = [
            Card.from_field_schemas_with_defaults(
                _CONTROLACOUSTICCOUPLING_CARD0,
                **kwargs,
            ),        ]
    @property
    def maccpl(self) -> int:
        """Get or set the Coupling method:
        EQ.3:	Projection with areal equilibration to enhance enforcement of the zero moments.
        The equilibration test examines the moments generated by the coupling matrix when the
        acoustic pressure is constant.If these moments are not zero(rare),
        then an attempt is made to adjust the coupling coefficients, so the moments are minimized.
        EQ.4 : Projection with no areal equilibration
        """ # nopep8
        return self._cards[0].get_value("maccpl")

    @maccpl.setter
    def maccpl(self, value: int) -> None:
        """Set the maccpl property."""
        self._cards[0].set_value("maccpl", value)

    @property
    def acecf1(self) -> float:
        """Get or set the Multiplier on proximity test
        """ # nopep8
        return self._cards[0].get_value("acecf1")

    @acecf1.setter
    def acecf1(self, value: float) -> None:
        """Set the acecf1 property."""
        self._cards[0].set_value("acecf1", value)

    @property
    def acecf2(self) -> float:
        """Get or set the Angle between normal vectors in an orientation test.
        """ # nopep8
        return self._cards[0].get_value("acecf2")

    @acecf2.setter
    def acecf2(self, value: float) -> None:
        """Set the acecf2 property."""
        self._cards[0].set_value("acecf2", value)

    @property
    def acecf3(self) -> float:
        """Get or set the Multiplier on ceiling test.
        """ # nopep8
        return self._cards[0].get_value("acecf3")

    @acecf3.setter
    def acecf3(self, value: float) -> None:
        """Set the acecf3 property."""
        self._cards[0].set_value("acecf3", value)

    @property
    def acecf4(self) -> float:
        """Get or set the Area equilibration threshold. The equilibration test is skipped when the accumulated area of the coupling
        matrix is less than the area of the structural face. This normally occurs with partial coverage.
        """ # nopep8
        return self._cards[0].get_value("acecf4")

    @acecf4.setter
    def acecf4(self, value: float) -> None:
        """Set the acecf4 property."""
        self._cards[0].set_value("acecf4", value)

