<reponame>dheepak-aot/queue-management-1<filename>api/app/schemas/theq/citizen_schema.py
'''Copyright 2018 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''

from marshmallow import fields

from app.models.theq import Citizen
from app.schemas import BaseSchema
from app.schemas.theq import ServiceReqSchema, CitizenStateSchema


class CitizenSchema(BaseSchema):

    class Meta(BaseSchema.Meta):
        model = Citizen
        include_relationships = True
        datetimeformat = '%Y-%m-%dT%H:%M:%SZ'

    citizen_id = fields.Int(dump_only=True)
    citizen_name = fields.Str()
    office_id = fields.Int()
    ticket_number = fields.Str(dump_only=True)
    citizen_comments = fields.Str()
    qt_xn_citizen_ind = fields.Int()
    counter_id = fields.Int()
    start_time = fields.DateTime()
    accurate_time_ind = fields.Int()
    service_reqs = fields.Nested(ServiceReqSchema(exclude=('citizen',)), many=True)
    cs = fields.Nested(CitizenStateSchema(exclude=('cs_state_desc', 'cs_id')))
    priority = fields.Int()
    user_id = fields.Int()

    # for walk-in
    notification_sent_time = fields.DateTime()
    notification_phone = fields.Str()
    notification_email = fields.Str()
    # reminder_flag
    # 0 - reminder not sent - grey icon
    # 1 - first reminder sent - blue icon
    # 2 - second reminder sent - red icon
    reminder_flag = fields.Int()
    walkin_unique_id = fields.Str()
    # 0/null-automatic reminder not send
    # 1-automatic reminder sent once
    automatic_reminder_flag = fields.Int()

    # Digital signange
    created_at = fields.DateTime()
