module Schema
  module DataStructure
    def self.included(cls)
      cls.class_exec do
        include Schema
        extend Build
        extend Virtual::Macro
        virtual :configure_dependencies
      end
    end

    module Build
      def build(data=nil)
        data ||= {}
        new.tap do |instance|
          set_attributes(instance, data)
          instance.configure_dependencies
        end
      end

      def set_attributes(instance, data)
        SetAttributes.(instance, data)
      end
    end
  end
end

module Schema
  module DataStructure
    def self.included(cls)
      cls.class_exec do
        include Schema
        extend Build
        extend Virtual::Macro
        virtual :configure_dependencies
        alias :configure :configure_dependencies
      end
    end

    module Build
      def build(data=nil)
        data ||= {}
        new.tap do |instance|
          set_attributes(instance, data)
          instance.configure_dependencies
        end
      end

      def set_attributes(instance, data)
        SetAttributes.(instance, data)
      end
    end
  end
end

Configure is an alias for configure_dependencies
Configure is an alias for configure_dependencies
