# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from __future__ import annotations

from darabonba.model import DaraModel

class SetDomainRequest(DaraModel):
    def __init__(
        self,
        bind_stage_name: str = None,
        custom_domain_type: str = None,
        domain_name: str = None,
        group_id: str = None,
        is_force: bool = None,
        is_http_redirect_to_https: bool = None,
    ):
        # The environment which you can access by using the domain name. If you do not specify this parameter, the domain name can be used to access all environments.
        # 
        # If you specify an environment, the domain name can be used to access only the specified environment. Valid values:
        # 
        # *   TEST
        # *   PRE
        # *   RELEASE
        # 
        # If you want to use the domain name to access all environments, set this parameter to an empty string ("").
        self.bind_stage_name = bind_stage_name
        # The network type of the domain name to be bound. Default value: INTERNET. Valid values:
        # 
        # *   INTERNET
        # *   INTRANET. If you set this parameter to this value, the domain name cannot be used on the Internet.
        self.custom_domain_type = custom_domain_type
        # The custom domain name.
        # 
        # This parameter is required.
        self.domain_name = domain_name
        # The ID of the API group. This ID is generated by the system and globally unique.
        # 
        # This parameter is required.
        self.group_id = group_id
        # Specifies whether this binding relationship takes precedence over the binding relationships between the domain name and other API groups. If you set this parameter to true, this binding relationship takes precedence, and the domain name is automatically unbound from other API groups. This operation brings risks. Proceed with caution.
        self.is_force = is_force
        # Specifies whether to redirect HTTP requests to HTTPS requests.
        self.is_http_redirect_to_https = is_http_redirect_to_https

    def validate(self):
        pass

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.bind_stage_name is not None:
            result['BindStageName'] = self.bind_stage_name

        if self.custom_domain_type is not None:
            result['CustomDomainType'] = self.custom_domain_type

        if self.domain_name is not None:
            result['DomainName'] = self.domain_name

        if self.group_id is not None:
            result['GroupId'] = self.group_id

        if self.is_force is not None:
            result['IsForce'] = self.is_force

        if self.is_http_redirect_to_https is not None:
            result['IsHttpRedirectToHttps'] = self.is_http_redirect_to_https

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('BindStageName') is not None:
            self.bind_stage_name = m.get('BindStageName')

        if m.get('CustomDomainType') is not None:
            self.custom_domain_type = m.get('CustomDomainType')

        if m.get('DomainName') is not None:
            self.domain_name = m.get('DomainName')

        if m.get('GroupId') is not None:
            self.group_id = m.get('GroupId')

        if m.get('IsForce') is not None:
            self.is_force = m.get('IsForce')

        if m.get('IsHttpRedirectToHttps') is not None:
            self.is_http_redirect_to_https = m.get('IsHttpRedirectToHttps')

        return self

