const Group = {
    create : function( p )
    {
        Object.assign( this, p.getAll() );
    },

    getId : function()
    {
        return this.id;
    },

    getCourseCategoryNameById : function( id )
    {
        var name = 'Allgemein';

        for ( var cgi = 0; cgi < this.course_categories_js.length; cgi++ )
        {
            if ( id === this.course_categories_js[ cgi ].id )
            {
                name = this.course_categories_js[ cgi ].name;
                break;
            }
        }

        return name;
    },
    hasValidContracteeData : function()
    {
        return ( null !== this.getContracteeData() );
    },

    getContracteeData : function( key )
    {
        if ( key )
        {
            if ( this.contractee_master_data_js && this.contractee_master_data_js.hasOwnProperty( key ) )
            {
                return this.contractee_master_data_js[ key ];
            }
            else
            {
                return null;
            }
        }
        else
        {
            return this.contractee_master_data_js;
        }
    },

    destroy : function()
    {

    }
};

export { Group };