// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// AccountStatus account status
//
// swagger:model AccountStatus
type AccountStatus struct {

	// account ID
	AccountID string `json:"AccountID,omitempty" gorm:"primary_key"`

	// created at
	// Format: datetime
	CreatedAt strfmt.DateTime `json:"CreatedAt,omitempty" gorm:"type:timestamptz"`

	// enabled
	// Required: true
	Enabled bool `json:"Enabled" gorm:"default:true"`
}

// Validate validates this account status
func (m *AccountStatus) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateCreatedAt(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateEnabled(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *AccountStatus) validateCreatedAt(formats strfmt.Registry) error {

	if swag.IsZero(m.CreatedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("CreatedAt", "body", "datetime", m.CreatedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *AccountStatus) validateEnabled(formats strfmt.Registry) error {

	if err := validate.Required("Enabled", "body", bool(m.Enabled)); err != nil {
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (m *AccountStatus) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *AccountStatus) UnmarshalBinary(b []byte) error {
	var res AccountStatus
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
