# Path: pyas2/models.py
# DEFAULT_ENTRY = ('', "---------")
#     CONTENT_TYPE_CHOICES = (
#         ('application/EDI-X12', 'application/EDI-X12'),
#         ('application/EDIFACT', 'application/EDIFACT'),
#         ('application/edi-consent', 'application/edi-consent'),
#         ('application/XML', 'application/XML'),
#         ('text/CSV', 'text/CSV'),
#     )
#     ENCRYPT_ALG_CHOICES = (
#         ('des_ede3_cbc', '3DES'),
#         ('des_cbc', 'DES'),
#         ('aes_128_cbc', 'AES-128'),
#         ('aes_192_cbc', 'AES-192'),
#         ('aes_256_cbc', 'AES-256'),
#         ('rc2_40_cbc', 'RC2-40'),
#     )
#     SIGN_ALG_CHOICES = (
#         ('sha1', 'SHA-1'),
#     )
#     MDN_TYPE_CHOICES = (
#         ('SYNC', 'Synchronous'),
#         ('ASYNC', 'Asynchronous'),
#     )
#     DIRECTION_CHOICES = (
#         ('IN', _('Inbound')),
#         ('OUT', _('Outbound')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Success')),
#         ('E', _('Error')),
#         ('W', _('Warning')),
#         ('P', _('Pending')),
#         ('R', _('Retry')),
#         ('IP', _('In Process')),
#     )
#     MODE_CHOICES = (
#         ('SYNC', _('Synchronous')),
#         ('ASYNC', _('Asynchronous')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Success')),
#         ('E', _('Error')),
#         ('W', _('Warning')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Sent')),
#         ('R', _('Received')),
#         ('P', _('Pending')),
#     )
# def get_certificate_path(instance, filename):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def getorganizations():
# def getpartners():
# def check_odirs(sender, instance, created, **kwargs):
# def check_pdirs(sender, instance, created, **kwargs):
# def update_dirs():
# class PrivateCertificate(models.Model):
# class PublicCertificate(models.Model):
# class Organization(models.Model):
# class Partner(models.Model):
# class Message(models.Model):
# class Payload(models.Model):
# class Log(models.Model):
# class MDN(models.Model):
# 
# Path: pyas2/viewlib.py
# def datetimefrom():
# def datetimeuntil():
# def url_with_querystring(path, **kwargs):
# def indent_x12(content):
# def indent_edifact(content):
# def indent_xml(content):
# EDIFACT_INDENT = re.compile('''
#     (?<!\?)     #if no preceding escape (?)
#     '           #apostrophe
#     (?![\n\r])  #if no following CR of LF
#     ''', re.VERBOSE)


from pyas2 import models
from django import forms
from pyas2 import viewlib

class MessageSearchForm(Select):
    organization = forms.ChoiceField([], required=False)
    partner = forms.ChoiceField([], required=False)
    direction = forms.ChoiceField([], required=False)
    status = forms.ChoiceField([], required=False)
    message_id = forms.CharField(required=False, label='Message ID', max_length=255)
    filename = forms.CharField(required=False, label='Payload Name', max_length=100)

    def __init__(self, *args, **kwargs):
        super(MessageSearchForm, self).__init__(*args, **kwargs)
        self.fields['organization'].choices = models.getorganizations()
        self.fields['partner'].choices = models.getpartners()
        self.fields['direction'].choices = [models.DEFAULT_ENTRY] + list(models.Message.DIRECTION_CHOICES)
        self.fields['status'].choices = [models.DEFAULT_ENTRY] + list(models.Message.STATUS_CHOICES)


class MDNSearchForm(Select):
    organization = forms.ChoiceField([], required=False)
    partner = forms.ChoiceField([], required=False)
    mdn_mode = forms.ChoiceField([], required=False)
    status = forms.ChoiceField([], required=False)
    message_id = forms.CharField(required=False, label='MDN Message ID', max_length=255)
    omessage_id = forms.CharField(required=False, label='Original Message ID', max_length=255)

    def __init__(self, *args, **kwargs):
        super(MDNSearchForm, self).__init__(*args, **kwargs)
        self.fields['organization'].choices = models.getorganizations()
        self.fields['partner'].choices = models.getpartners()
        self.fields['status'].choices = [models.DEFAULT_ENTRY] + list(models.MDN.STATUS_CHOICES)

# Path: pyas2/models.py
# DEFAULT_ENTRY = ('', "---------")
#     CONTENT_TYPE_CHOICES = (
#         ('application/EDI-X12', 'application/EDI-X12'),
#         ('application/EDIFACT', 'application/EDIFACT'),
#         ('application/edi-consent', 'application/edi-consent'),
#         ('application/XML', 'application/XML'),
#         ('text/CSV', 'text/CSV'),
#     )
#     ENCRYPT_ALG_CHOICES = (
#         ('des_ede3_cbc', '3DES'),
#         ('des_cbc', 'DES'),
#         ('aes_128_cbc', 'AES-128'),
#         ('aes_192_cbc', 'AES-192'),
#         ('aes_256_cbc', 'AES-256'),
#         ('rc2_40_cbc', 'RC2-40'),
#     )
#     SIGN_ALG_CHOICES = (
#         ('sha1', 'SHA-1'),
#     )
#     MDN_TYPE_CHOICES = (
#         ('SYNC', 'Synchronous'),
#         ('ASYNC', 'Asynchronous'),
#     )
#     DIRECTION_CHOICES = (
#         ('IN', _('Inbound')),
#         ('OUT', _('Outbound')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Success')),
#         ('E', _('Error')),
#         ('W', _('Warning')),
#         ('P', _('Pending')),
#         ('R', _('Retry')),
#         ('IP', _('In Process')),
#     )
#     MODE_CHOICES = (
#         ('SYNC', _('Synchronous')),
#         ('ASYNC', _('Asynchronous')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Success')),
#         ('E', _('Error')),
#         ('W', _('Warning')),
#     )
#     STATUS_CHOICES = (
#         ('S', _('Sent')),
#         ('R', _('Received')),
#         ('P', _('Pending')),
#     )
# def get_certificate_path(instance, filename):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def getorganizations():
# def getpartners():
# def check_odirs(sender, instance, created, **kwargs):
# def check_pdirs(sender, instance, created, **kwargs):
# def update_dirs():
# class PrivateCertificate(models.Model):
# class PublicCertificate(models.Model):
# class Organization(models.Model):
# class Partner(models.Model):
# class Message(models.Model):
# class Payload(models.Model):
# class Log(models.Model):
# class MDN(models.Model):
# 
# Path: pyas2/viewlib.py
# def datetimefrom():
# def datetimeuntil():
# def url_with_querystring(path, **kwargs):
# def indent_x12(content):
# def indent_edifact(content):
# def indent_xml(content):
# EDIFACT_INDENT = re.compile('''
#     (?<!\?)     #if no preceding escape (?)
#     '           #apostrophe
#     (?![\n\r])  #if no following CR of LF
#     ''', re.VERBOSE)


# Path: pyas2/forms.py
from pyas2 import models
from django import forms
from pyas2 import viewlib


class MessageSearchForm(Select):
    organization = forms.ChoiceField([], required=False)
    partner = forms.ChoiceField([], required=False)
    direction = forms.ChoiceField([], required=False)
    status = forms.ChoiceField([], required=False)
    message_id = forms.CharField(required=False, label='Message ID', max_length=255)
    filename = forms.CharField(required=False, label='Payload Name', max_length=100)

    def __init__(self, *args, **kwargs):
        super(MessageSearchForm, self).__init__(*args, **kwargs)
        self.fields['organization'].choices = models.getorganizations()
        self.fields['partner'].choices = models.getpartners()
        self.fields['direction'].choices = [models.DEFAULT_ENTRY] + list(models.Message.DIRECTION_CHOICES)
        self.fields['status'].choices = [models.DEFAULT_ENTRY] + list(models.Message.STATUS_CHOICES)


class MDNSearchForm(Select):
    organization = forms.ChoiceField([], required=False)
    partner = forms.ChoiceField([], required=False)
    mdn_mode = forms.ChoiceField([], required=False)
    status = forms.ChoiceField([], required=False)
    message_id = forms.CharField(required=False, label='MDN Message ID', max_length=255)
    omessage_id = forms.CharField(required=False, label='Original Message ID', max_length=255)

    def __init__(self, *args, **kwargs):
        super(MDNSearchForm, self).__init__(*args, **kwargs)
        self.fields['organization'].choices = models.getorganizations()
        self.fields['partner'].choices = models.getpartners()
        self.fields['status'].choices = [models.DEFAULT_ENTRY] + list(models.MDN.STATUS_CHOICES)

        self.fields['mdn_mode'].choices = [models.DEFAULT_ENTRY] + list(models.Message.MODE_CHOICES)