# -*- coding: utf-8 -*-

"""
coingeckopublicapiv3

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from coingeckopublicapiv3.api_helper import APIHelper
from coingeckopublicapiv3.models.code_additions_deletions_4_weeks_1 import CodeAdditionsDeletions4Weeks1


class DeveloperData1(object):

    """Implementation of the 'DeveloperData1' model.

    coin developer data

    Attributes:
        forks (float): coin repository forks
        stars (float): coin repository stars
        subscribers (float): coin repository subscribers
        total_issues (float): coin repository total issues
        closed_issues (float): coin repository closed issues
        pull_requests_merged (float): coin repository pull requests merged
        pull_request_contributors (float): coin repository pull request
            contributors
        code_additions_deletions_4_weeks (CodeAdditionsDeletions4Weeks1): coin
            code additions deletions 4 weeks
        commit_count_4_weeks (float): coin commit count 4 weeks

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "forks": 'forks',
        "stars": 'stars',
        "subscribers": 'subscribers',
        "total_issues": 'total_issues',
        "closed_issues": 'closed_issues',
        "pull_requests_merged": 'pull_requests_merged',
        "pull_request_contributors": 'pull_request_contributors',
        "code_additions_deletions_4_weeks": 'code_additions_deletions_4_weeks',
        "commit_count_4_weeks": 'commit_count_4_weeks'
    }

    _optionals = [
        'forks',
        'stars',
        'subscribers',
        'total_issues',
        'closed_issues',
        'pull_requests_merged',
        'pull_request_contributors',
        'code_additions_deletions_4_weeks',
        'commit_count_4_weeks',
    ]

    def __init__(self,
                 forks=APIHelper.SKIP,
                 stars=APIHelper.SKIP,
                 subscribers=APIHelper.SKIP,
                 total_issues=APIHelper.SKIP,
                 closed_issues=APIHelper.SKIP,
                 pull_requests_merged=APIHelper.SKIP,
                 pull_request_contributors=APIHelper.SKIP,
                 code_additions_deletions_4_weeks=APIHelper.SKIP,
                 commit_count_4_weeks=APIHelper.SKIP):
        """Constructor for the DeveloperData1 class"""

        # Initialize members of the class
        if forks is not APIHelper.SKIP:
            self.forks = forks 
        if stars is not APIHelper.SKIP:
            self.stars = stars 
        if subscribers is not APIHelper.SKIP:
            self.subscribers = subscribers 
        if total_issues is not APIHelper.SKIP:
            self.total_issues = total_issues 
        if closed_issues is not APIHelper.SKIP:
            self.closed_issues = closed_issues 
        if pull_requests_merged is not APIHelper.SKIP:
            self.pull_requests_merged = pull_requests_merged 
        if pull_request_contributors is not APIHelper.SKIP:
            self.pull_request_contributors = pull_request_contributors 
        if code_additions_deletions_4_weeks is not APIHelper.SKIP:
            self.code_additions_deletions_4_weeks = code_additions_deletions_4_weeks 
        if commit_count_4_weeks is not APIHelper.SKIP:
            self.commit_count_4_weeks = commit_count_4_weeks 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """

        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        forks = dictionary.get("forks") if dictionary.get("forks") else APIHelper.SKIP
        stars = dictionary.get("stars") if dictionary.get("stars") else APIHelper.SKIP
        subscribers = dictionary.get("subscribers") if dictionary.get("subscribers") else APIHelper.SKIP
        total_issues = dictionary.get("total_issues") if dictionary.get("total_issues") else APIHelper.SKIP
        closed_issues = dictionary.get("closed_issues") if dictionary.get("closed_issues") else APIHelper.SKIP
        pull_requests_merged = dictionary.get("pull_requests_merged") if dictionary.get("pull_requests_merged") else APIHelper.SKIP
        pull_request_contributors = dictionary.get("pull_request_contributors") if dictionary.get("pull_request_contributors") else APIHelper.SKIP
        code_additions_deletions_4_weeks = CodeAdditionsDeletions4Weeks1.from_dictionary(dictionary.get('code_additions_deletions_4_weeks')) if 'code_additions_deletions_4_weeks' in dictionary.keys() else APIHelper.SKIP
        commit_count_4_weeks = dictionary.get("commit_count_4_weeks") if dictionary.get("commit_count_4_weeks") else APIHelper.SKIP
        # Return an object of this model
        return cls(forks,
                   stars,
                   subscribers,
                   total_issues,
                   closed_issues,
                   pull_requests_merged,
                   pull_request_contributors,
                   code_additions_deletions_4_weeks,
                   commit_count_4_weeks)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'forks={(self.forks if hasattr(self, "forks") else None)!r}, '
                f'stars={(self.stars if hasattr(self, "stars") else None)!r}, '
                f'subscribers={(self.subscribers if hasattr(self, "subscribers") else None)!r}, '
                f'total_issues={(self.total_issues if hasattr(self, "total_issues") else None)!r}, '
                f'closed_issues={(self.closed_issues if hasattr(self, "closed_issues") else None)!r}, '
                f'pull_requests_merged={(self.pull_requests_merged if hasattr(self, "pull_requests_merged") else None)!r}, '
                f'pull_request_contributors={(self.pull_request_contributors if hasattr(self, "pull_request_contributors") else None)!r}, '
                f'code_additions_deletions_4_weeks={(self.code_additions_deletions_4_weeks if hasattr(self, "code_additions_deletions_4_weeks") else None)!r}, '
                f'commit_count_4_weeks={(self.commit_count_4_weeks if hasattr(self, "commit_count_4_weeks") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'forks={(self.forks if hasattr(self, "forks") else None)!s}, '
                f'stars={(self.stars if hasattr(self, "stars") else None)!s}, '
                f'subscribers={(self.subscribers if hasattr(self, "subscribers") else None)!s}, '
                f'total_issues={(self.total_issues if hasattr(self, "total_issues") else None)!s}, '
                f'closed_issues={(self.closed_issues if hasattr(self, "closed_issues") else None)!s}, '
                f'pull_requests_merged={(self.pull_requests_merged if hasattr(self, "pull_requests_merged") else None)!s}, '
                f'pull_request_contributors={(self.pull_request_contributors if hasattr(self, "pull_request_contributors") else None)!s}, '
                f'code_additions_deletions_4_weeks={(self.code_additions_deletions_4_weeks if hasattr(self, "code_additions_deletions_4_weeks") else None)!s}, '
                f'commit_count_4_weeks={(self.commit_count_4_weeks if hasattr(self, "commit_count_4_weeks") else None)!s})')
