# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from marshmallow import Schema, fields, post_load

from polyaxon_schemas.base import BaseConfig


class GlobalConfigurationSchema(Schema):
    verbose = fields.Bool(allow_none=True)
    host = fields.Str(allow_none=True)
    working_directory = fields.Str(allow_none=True)

    class Meta:
        ordered = True

    @post_load
    def make(self, data):
        return GlobalConfigurationConfig(**data)


class GlobalConfigurationConfig(BaseConfig):
    SCHEMA = GlobalConfigurationSchema
    IDENTIFIER = 'global'

    def __init__(self, verbose=False, host='localhost', working_directory='.'):
        self.verbose = verbose
        self.host = host
        self.working_directory = working_directory

@@ -132,16 +132,27 @@
 ost_load
+, post_dump
 %0A%0Afrom p
@@ -499,16 +499,128 @@
 *data)%0A%0A
+    @post_dump%0A    def unmake(self, data):%0A        return GlobalConfigurationConfig.remove_reduced_attrs(data)%0A%0A
 %0Aclass G

Update global config