# Path: examples/peewee_orm/models.py
# class Pet(pw.Model):
# 
#     created = pw.DateTimeField(default=dt.datetime.utcnow)
#     name = pw.CharField()
#     image = pw.CharField(null=True)
#     status = pw.CharField(choices=[
#         ('available', 'available'), ('pending', 'pending'), ('sold', 'sold')])
# 
#     category = pw.ForeignKeyField(Category)
# 
# class Category(pw.Model):
#     name = pw.CharField()


import marshmallow as ma
from marshmallow_peewee import ModelSchema
from .models import Pet, Category



class CategorySchema(ModelSchema):

    class Meta:
        model = Category


class PetSchema(ModelSchema):

    category = ma.fields.Nested(CategorySchema)

    class Meta:

# Path: examples/peewee_orm/models.py
# class Pet(pw.Model):
# 
#     created = pw.DateTimeField(default=dt.datetime.utcnow)
#     name = pw.CharField()
#     image = pw.CharField(null=True)
#     status = pw.CharField(choices=[
#         ('available', 'available'), ('pending', 'pending'), ('sold', 'sold')])
# 
#     category = pw.ForeignKeyField(Category)
# 
# class Category(pw.Model):
#     name = pw.CharField()


# Path: examples/peewee_orm/schemas.py
import marshmallow as ma
from marshmallow_peewee import ModelSchema
from .models import Pet, Category




class CategorySchema(ModelSchema):

    class Meta:
        model = Category


class PetSchema(ModelSchema):

    category = ma.fields.Nested(CategorySchema)

    class Meta:

        model = Pet