=begin comment

Kubernetes

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

OpenAPI spec version: v1.13.5

Generated by: https://openapi-generator.tech

=end comment

=cut

#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
package Kubernetes::Object::V1beta1CustomResourceDefinitionVersion;

require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;

use Kubernetes::Object::V1beta1CustomResourceColumnDefinition;
use Kubernetes::Object::V1beta1CustomResourceSubresources;
use Kubernetes::Object::V1beta1CustomResourceValidation;

use base ("Class::Accessor", "Class::Data::Inheritable");


#
#CustomResourceDefinitionVersion describes a version for CRD.
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually.
# REF: https://openapi-generator.tech
#

=begin comment

Kubernetes

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

OpenAPI spec version: v1.13.5

Generated by: https://openapi-generator.tech

=end comment

=cut

#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('openapi_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {}); 
__PACKAGE__->mk_classdata('class_documentation' => {});

# new object
sub new { 
    my ($class, %args) = @_; 

	my $self = bless {}, $class;
	
	foreach my $attribute (keys %{$class->attribute_map}) {
		my $args_key = $class->attribute_map->{$attribute};
		$self->$attribute( $args{ $args_key } );
	}
	
	return $self;
}  

# return perl hash
sub to_hash {
    return decode_json(JSON->new->convert_blessed->encode( shift ));
}

# used by JSON for serialization
sub TO_JSON { 
    my $self = shift;
    my $_data = {};
    foreach my $_key (keys %{$self->attribute_map}) {
        if (defined $self->{$_key}) {
            $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
        }
    }
    return $_data;
}

# from Perl hashref
sub from_hash {
    my ($self, $hash) = @_;

    # loop through attributes and use openapi_types to deserialize the data
    while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
    	my $_json_attribute = $self->attribute_map->{$_key}; 
        if ($_type =~ /^array\[/i) { # array
            my $_subclass = substr($_type, 6, -1);
            my @_array = ();
            foreach my $_element (@{$hash->{$_json_attribute}}) {
                push @_array, $self->_deserialize($_subclass, $_element);
            }
            $self->{$_key} = \@_array;
        } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
            $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
        } else {
        	$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
        }
    }
  
    return $self;
}

# deserialize non-array data
sub _deserialize {
    my ($self, $type, $data) = @_;
    $log->debugf("deserializing %s with %s",Dumper($data), $type);
        
    if ($type eq 'DateTime') {
        return DateTime->from_epoch(epoch => str2time($data));
    } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
        return $data;
    } else { # hash(model)
        my $_instance = eval "Kubernetes::Object::$type->new()";
        return $_instance->from_hash($data);
    }
}



__PACKAGE__->class_documentation({description => 'CustomResourceDefinitionVersion describes a version for CRD.',
                                  class => 'V1beta1CustomResourceDefinitionVersion',
                                  required => [], # TODO
}                                 );

__PACKAGE__->method_documentation({
    'additional_printer_columns' => {
    	datatype => 'ARRAY[V1beta1CustomResourceColumnDefinition]',
    	base_name => 'additionalPrinterColumns',
    	description => 'AdditionalPrinterColumns are additional columns shown e.g. in kubectl next to the name. Defaults to a created-at column. Top-level and per-version columns are mutually exclusive. Per-version columns must not all be set to identical values (top-level columns should be used instead) This field is alpha-level and is only honored by servers that enable the CustomResourceWebhookConversion feature. NOTE: CRDs created prior to 1.13 populated the top-level additionalPrinterColumns field by default. To apply an update that changes to per-version additionalPrinterColumns, the top-level additionalPrinterColumns field must be explicitly set to null',
    	format => '',
    	read_only => '',
    		},
    'name' => {
    	datatype => 'string',
    	base_name => 'name',
    	description => 'Name is the version name, e.g. “v1”, “v2beta1”, etc.',
    	format => '',
    	read_only => '',
    		},
    'schema' => {
    	datatype => 'V1beta1CustomResourceValidation',
    	base_name => 'schema',
    	description => '',
    	format => '',
    	read_only => '',
    		},
    'served' => {
    	datatype => 'boolean',
    	base_name => 'served',
    	description => 'Served is a flag enabling/disabling this version from being served via REST APIs',
    	format => '',
    	read_only => '',
    		},
    'storage' => {
    	datatype => 'boolean',
    	base_name => 'storage',
    	description => 'Storage flags the version as storage version. There must be exactly one flagged as storage version.',
    	format => '',
    	read_only => '',
    		},
    'subresources' => {
    	datatype => 'V1beta1CustomResourceSubresources',
    	base_name => 'subresources',
    	description => '',
    	format => '',
    	read_only => '',
    		},
});

__PACKAGE__->openapi_types( {
    'additional_printer_columns' => 'ARRAY[V1beta1CustomResourceColumnDefinition]',
    'name' => 'string',
    'schema' => 'V1beta1CustomResourceValidation',
    'served' => 'boolean',
    'storage' => 'boolean',
    'subresources' => 'V1beta1CustomResourceSubresources'
} );

__PACKAGE__->attribute_map( {
    'additional_printer_columns' => 'additionalPrinterColumns',
    'name' => 'name',
    'schema' => 'schema',
    'served' => 'served',
    'storage' => 'storage',
    'subresources' => 'subresources'
} );

__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});


1;
