# coding: utf-8
# Copyright (c) 2016, 2026, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20251031

from .fleet_assignment_policy import FleetAssignmentPolicy
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
from oci.decorators import init_model_state_from_kwargs


@init_model_state_from_kwargs
class FlexFitFleetAssignmentPolicy(FleetAssignmentPolicy):
    """
    Similar to best-fit, but with the ability for the system to use larger fleets if the smallest sufficient fleet
    is not available, up to a specified max shaped fleet, based on a user-configured threshold value.
    """

    def __init__(self, **kwargs):
        """
        Initializes a new FlexFitFleetAssignmentPolicy object with values from keyword arguments. The default value of the :py:attr:`~oci.batch.models.FlexFitFleetAssignmentPolicy.type` attribute
        of this class is ``FLEX_FIT`` and it should not be changed.
        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param type:
            The value to assign to the type property of this FlexFitFleetAssignmentPolicy.
            Allowed values for this property are: "BEST_FIT", "FLEX_FIT"
        :type type: str

        :param threshold:
            The value to assign to the threshold property of this FlexFitFleetAssignmentPolicy.
        :type threshold: float

        """
        self.swagger_types = {
            'type': 'str',
            'threshold': 'float'
        }
        self.attribute_map = {
            'type': 'type',
            'threshold': 'threshold'
        }
        self._type = None
        self._threshold = None
        self._type = 'FLEX_FIT'

    @property
    def threshold(self):
        """
        Gets the threshold of this FlexFitFleetAssignmentPolicy.
        Specifies how much larger a fleet's nodes (shape) can be to still be considered for a task.
        If threshold is not supplied the task will use any sufficient node available regards to minimum hardware requirements.


        :return: The threshold of this FlexFitFleetAssignmentPolicy.
        :rtype: float
        """
        return self._threshold

    @threshold.setter
    def threshold(self, threshold):
        """
        Sets the threshold of this FlexFitFleetAssignmentPolicy.
        Specifies how much larger a fleet's nodes (shape) can be to still be considered for a task.
        If threshold is not supplied the task will use any sufficient node available regards to minimum hardware requirements.


        :param threshold: The threshold of this FlexFitFleetAssignmentPolicy.
        :type: float
        """
        self._threshold = threshold

    def __repr__(self):
        return formatted_flat_dict(self)

    def __eq__(self, other):
        if other is None:
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not self == other
