"""
Constants defining requirements of model fields.
To be used to decide wether a test should run or fail and which tests to run to test for self-preserved integrity.
"""
from pt_map.models import *

field_requirements = \
[
    {
        "model": "Agency",
        "fields": [
            {
                "name": "agency_id",
                "type": "pk",
                "required": "false",
                "default": "yes",
            }, 
            {
                "name": "agency_name",
                "type": "str",
                "required": "true",
            },
            {
                "name": "agency_url",
                "type": "url",
                "required": "true",
            },
            {
                "name": "agency_fare_url",
                "type": "url",
                "required": "false",
            },
            {
                "name": "agency_timezone",
                "type": "timezone",
                "required": "true",
            },
            {
                "name": "agency_lang",
                "type": "langcode",
                "required": "false",
            },
            {
                "name": "agency_phone",
                "type": "telephone",
                "required": "false",
            },
            {
                "name": "agency_email",
                "type": "email",
                "required": "false",
            },
            ],
        "pk": "agency_id",
    },
    {
    "model": "Stop",
    "fields": [
        {
            "name": "stop_id",
            "type": "pk",
            "required": "true",
        }, 
        {
            "name": "stop_code",
            "type": "str",
            "required": "false",
        },
        {
            "name": "stop_name",
            "type": "str",
            "required": "true",
        },
        {   
            "name": "tts_stop_name",
            "type": "str",
            "required": "false",
        },
        {
            "name": "stop_desc",
            "type": "str",
            "required": "false",
        },
        {
            "name": "stop_lat",
            "type": "float",
            "required": "if",
            "required_if": ["location_type", [0,1,2]],
        },
        {
            "name": "stop_lon",
            "type": "float",
            "required": "if",
            "required_if": ["location_type", [0,1,2]],
        },
        {
            "name": "zone_id",
            "type": "str",
            "required": "false",
        },
        {
            "name": "stop_url",
            "type": "url",
            "required": "false",
        },
        {
            "name": "location_type",
            "type": "int",
            "required": "true",
        },
        {
            "name": "parent_station",
            "type": "fk",
            "references": Stop,
            "required": "if",
            "required_if": ["location_type", [2,3,4]],
            "forbidden_if": ["location_type", [1]],
        },
        {
            "name": "stop_timezone",
            "type": "timezone",
            "required": "false",
        },
        {
            "name": "wheelchair_boarding",
            "type": "int",
            "required": "false",
        },
        {
            "name": "level_id",
            "type": "fk",
            "references": Level,
            "required": "false",
        },
        {
            "name": "platform_code",
            "type": "str",
            "required": "false",
        },
        ],
        "pk": "stop_id",
    },
    {
    "model": "Route",
    "fields": [
        {
            "name": "route_id",
            "type": "pk",
            "required": "true",
        }, 
        {
            "name": "agency_id",
            "type": "fk",
            "required": "false",
            "default": "yes",
        },
        {
            "name": "route_short_name",
            "type": "str",
            "required": "if",
            "required_if": ["route_long_name", None],
        },
        {
            "name": "route_long_name",
            "type": "str",
            "required": "if",
            "required_if": ["route_short_name", None],
        },
        {
            "name": "route_desc",
            "type": "str",
            "required": "false",
        },
        {
            "name": "route_type",
            "type": "int",
            "required": "true",
        },
        {
            "name": "route_url",
            "type": "url",
            "required": "false",
        },
        {
            "name": "route_color",
            "type": "str",
            "required": "false",
        },
        {
            "name": "route_text_color",
            "type": "str",
            "required": "false",
        },
        {
            "name": "continuous_pickup",
            "type": "enum",
            "allowed_values": [0,1,2,3,], 
            "required": "false",
        },
        {
            "name": "continuous_dropoff",
            "type": "enum",
            "allowed_values": [0,1,2,3,], 
            "required": "false",
        },
        {
            "name": "network_id",
            "type": "mtm",
            "references": Route,
            "required": "false",
            "forbidden_if": ["RouteNetwork", True]
        },
        ],
        "pk": "route_id",
    },
    {
    "model": "Trip",
    "fields": [
        {
            "name": "trip_id",
            "type": "pk",
            "required": "true",
        }, 
        {
            "name": "route_id",
            "type": "fk",
            "references": Route,
            "required": "true",
        },
        {
            "name": "service_id",
            "type": "fk",
            "references": [Calendar, CalendarDate],
            "required": "true",
        },
        {
            "name": "trip_headsign",
            "type": "str",
            "required": "false",
        },
        {
            "name": "trip_short_name",
            "type": "str",
            "required": "false",
        },
        {
            "name": "direction_id",
            "type": "enum",
            "allowed_values": [0,1,],
            "required": "false",
        },
        {
            "name": "block_id",
            "type": "mtm",
            "references": Trip,
            "required": "false",
        },
        {
            "name": "shape_id",
            "type": "fk",
            "references": Shape,
            "required": "false",
        },
        {
            "name": "wheelchair_accessible",
            "type": "enum",
            "allowed_values": [0,1,2,],
            "required": "false",
        },
        {
            "name": "bikes_allowed",
            "type": "enum",
            "allowed_values": [0,1,2,],
            "required": "false",
        },
        ],
        "pk": "trip_id",
    },
    {
    "model": "StopTime",
    "fields": [
        {
            "name": "trip_id",
            "type": "fk",
            "references": Trip,
            "required": "true",
        }, 
        {
            "name": "arrival_time",
            "type": "time",
            "required": "if",
            "required_if": [["stop_sequence", 1, -1], ["timepoint", 1]],
        },
        {
            "name": "departure_time",
            "type": "time",
            "required": "if",
            "required_if": [["timepoint", 1]],
        },
        {
            "name": "stop_id",
            "type": "fk",
            "references": Stop,
            "required": "if",
            "required_if": [(["location_group", None], ["location_id", None])],
            "forbidden_if_not": [["location_group", None], ["location_id", None]],
        },
        {
            "name": "location_group_id",
            "type": "mtm",
            "references": LocationGroup,
            "required": "false",
            "forbidden_if_not": [(["stop_id", None], ["location_id", None])],
        },
        {
            "name": "location_id",
            "type": "fk",
            "references": LocationsGeojson,
            "forbidden_if_not": [(["stop_id", None], ["location_group_id", None])],
        },
        {
            "name": "stop_sequence",
            "type": "unsigned",
            "required": "true",
        },
        {
            "name": "stop_headsign",
            "type": "str",
            "required": "false",
        },
        {
            "name": "start_pickup_drop_off_window",
            "type": "time",
            "required": "if",
            "required_if_not": [["location_group_id", None], ["location_id", None], ["end_pickup_drop_off_window", None]],
            "forbidden_if_not": [["arrival_time", None], ["departure_time", None]],
        },
        {
            "name": "end_pickup_drop_off_window",
            "type": "time",
            "required": "if",
            "required_if_not": [["location_group_id", None], ["location_id", None], ["start_pickup_drop_off_window", None]],
            "forbidden_if_not": [["arrival_time", None], ["departure_time", None]],
        },
        {
            "name": "pickup_type",
            "type": "enum",
            "allowed_values": [0,1,2,3],
            "required": "false",
            "forbidden_if_not": [(["pickup_type", 0, 3], ["start_pickup_drop_off_window", None], ["end_pickup_drop_off_window", None]),]
        },
        {
            "name": "drop_off_type",
            "type": "enum",
            "allowed_values": [0,1,2,3,],
            "required": "false",
            "forbidden_if": [(["drop_off_type", 0], ["start_pickup_drop_off_window", None], ["end_pickup_drop_off_window", None])],
        },
        {
            "name": "continuous_pickup",
            "type": "enum",
            "allowed_values": [0,1,2,3,],
            "required": "false",
            "forbidden_if_not": [(["start_pickup_drop_off_window", None], ["end_pickup_drop_off_window", None])],
        },
        {
            "name": "continuous_drop_off",
            "type": "enum",
            "allowed_values": [0,1,2,3,],
            "required": "false",
            "forbidden_if_not": [(["start_pickup_drop_off_window", None], ["end_pickup_drop_off_window", None])],
        },
        {
            "name": "shape_dist_traveled",
            "type": "float",
            "required": "false",
        },
        {
            "name": "timepoint",
            "type": "enum",
            "allowed_values": [0,1,],
            "required": "false",
        },
        {
            "name": "pickup_booking_rule_id",
            "type": "fk",
            "references": BookingRule,
            "required": "false",
        },
        {
            "name": "drop_off_booking_rule_id",
            "type": "fk",
            "references": BookingRule,
            "required": "false",
        },
        ],
        "pk": ["trip_id", "stop_sequence"],
    },
    {
    "model": "Calendar",
    "fields": [
        {
            "name": "service_id",
            "type": "unique",
            "required": "true",
        }, 
        {
            "name": "monday",
            "type": "enum",
            "allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "tuesday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "wednesday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "thursday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "friday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "saturday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "sunday",
            "type": "enum",
			"allowed_values": [0,1],
            "required": "true",
        },
        {
            "name": "start_date",
            "type": "date",
            "required": "true",
        },
        {
            "name": "end_date",
            "type": "date",
            "required": "true",
        },
        ],
        "pk": "service_id",
    },
    {
    "model": "CalendarDate",
    "fields": [
        {
            "name": "service_id",
            "type": "str",
            "required": "true",
        }, 
        {
            "name": "date",
            "type": "date",
            "required": "true",
        },
        {
            "name": "exception_type",
            "type": "enum",
            "allowed_values": [1,2,],
            "required": "true",
        },
        ],
        "pk": ["service_id", "date"],
    },
    {
    "model": "FareAttribute",
    "fields": [
        {
            "name": "fare_id",
            "type": "pk",
            "required": "true",
        }, 
        {
            "name": "price",
            "type": "float",
            "required": "true",
        },
        {
            "name": "currency_type",
            "type": "curcode",
            "required": "true",
        },
        {
            "name": "payment_method",
            "type": "enum",
            "allowed_values": [0,1,],
            "required": "true",
        },
        {
            "name": "transfers",
            "type": "enum",
            "allowed_values": [0,1,2,None],
            "required": "true",
        },
        {
            "name": "agency_id",
            "type": "fk",
            "references": Agency,
            "required": "false",
            "default": "yes",
        },
        {
            "name": "transfer_duration",
            "type": "unsigned",
            "required": "true",
        },
        ],
        "pk": "fare_id",
    },
    {
    "model": "FareRules",
    "fields": [
        {
            "name": "fare_id",
            "type": "fk",
            "references": FareAttribute,
            "required": "true",
        }, 
        {
            "name": "route_id",
            "type": "fk",
            "references": Route,
            "required": "true",
        },
        {
            "name": "origin_id",
            "type": "mtm",
            "references": Stop,
            "required": "true",
        },
        {
            "name": "destination_id",
            "type": "mtm",
            "references": Stop,
            "required": "true",
        },
        {
            "name": "contains_id",
            "type": "mtm",
            "references": Stop,
            "required": "false",
        },
        ],
        "pk": None,
    },
    {
    "model": "Timeframe",
    "fields": [
        {
            "name": "timeframe_group_id",
            "type": "str",
            "required": "true",
        },
        {
            "name": "start_time",
            "type": "time",
            "required": "if",
            "required_if_not": [["end_time", None]],
            "forbidden_if": [["end_time", None]],
        },
        {
            "name": "end_time",
            "type": "time",
            "required": "if",
            "required_if_not": [["start_time", None]],
            "forbidden_if": [["start_time", None]],
        },
        {
            "name": "service_id",
            "type": "str",
            "required": "true",
        }
        ],
        "pk": None,
    },
    {
    "model": "FareMedium",
    "fields": [
            {
                "name": "fare_media_id",
                "type": "pk",
                "required": "true",
            },
            {
                "name": "fare_media_name",
                "type": "str",
                "required": "false",
            },
            {
                "name": "fare_media_type",
                "type": "enum",
                "allowed_values": [0,1,2,3,4,],
                "required": "false",
            },
        ],
        "pk": "fare_media_id",
    },
    {
    "model": "FareProduct",
    "fields": [
            {
                "name": "fare_product_id",
                "type": "str",
                "required": "true",
            },
            {
                "name": "fare_product_name",
                "type": "str",
                "required": "false",
            },
            {
                "name": "fare_media_id",
                "type": "fk",
                "references": FareMedium,
                "required": "false",
            },
            {
                "name": "amount",
                "type": "float",
                "required": "true",
            },
            {
                "name": "currency",
                "type": "curcode",
                "required": "true",
            },
        ],
        "pk": ["fare_product_id", "fare_media_id"]
    },
    {
    "model": "FareLegRule",
    "fields": [
        {
            "name": "leg_group_id",
            "type": "str",
            "required": "false",
        },
        {
            "name": "network_id",
            "type": "str",
            "required": "false",
        },
        {
            "name": "from_area_id",
            "type": "fk",
            "references": Area,
            "required": "false",
        },
        {
            "name": "to_area_id",
            "type": "fk",
            "references": Area,
            "required": "false",
        },
        {
            "name": "from_timeframe_group_id",
            "type": "mtm",
            "references": Timeframe,
            "required": "false",
        },
        {
            "name": "to_timeframe_group_id",
            "type": "mtm",
            "references": Timeframe,
            "required": "false",
        },
        {
            "name": "fare_product_id",
            "type": "fk",
            "references": FareProduct,
            "required": "true",
        },
        {
            "name": "rule_priority",
            "type": "unsigned",
            "required": "false",
        },
        ],
        "pk": ["network_id", "from_area_id", "to_area_id", "from_timeframe_group_id", "to_timeframe_group_id", "fare_product_id"],
    },
    {
    "model": "FareTransferRule",
    "fields": [
        {
            "name": "from_leg_group_id",
            "type": "mtm",
            "references": FareLegRule,
            "required": "false",
        },
        {
            "name": "to_leg_group_id",
            "type": "mtm",
            "references": FareLegRule,
            "required": "false",
        },
        {
            "name": "transfer_count",
            "type": "int",
            "required": "if",
            "required_if_eq": ["from_leg_group_id", "to_leg_group_id"],
            "forbidden_if_not_eq": ["from_leg_group_id", "to_leg_group_id"],
        },
        {
            "name": "duration_limit",
            "type": "unsigned",
            "required": "false",
        },
        {
            "name": "duration_limit_type",
            "type": "enum",
            "allowed_values": [0,1,2,3,],
            "required_if_not": [["duration_limit", None]],
            "forbidden_if": [["duration_limit", None]],
        },
        {
            "name": "fare_transfer_type",
            "type": "enum",
            "allowed_values": [0,1,2],
            "required": "true",
        },
        {
            "name": "fare_product_id",
            "type": "fk",
            "references": FareProduct,
            "required": "false",
        },
        ],
        "pk": ["from_leg_group_id", "to_leg_group_id", "fare_product_id", "transfer_count", "duration_limit"],
    },
    {
    "model": "Area",
    "fields": [
        {
            "name": "area_id",
            "type": "pk",
            "required": "true",
        },
        {
            "name": "area_name",
            "type": "str",
            "required": "false",
        },
        ],
        "pk": "area_id",
    },
    {
    "model": "StopArea",
    "fields": [
        {
            "name": "area_id",
            "type": "fk",
            "references": Area,
            "required": "true",
        },
        {
            "name": "stop_id",
            "type": "fk",
            "references": Stop,
            "required": "true",
        },
        ],
        "pk": None,
    },
    {
    "model": "Network", 
    "fields": [
        {
            "name": "network_id",
            "type": "pk",
            "required": "true",
        },
        {
            "name": "network_name",
            "type": "str",
            "required": "false",
        },
        ],
        "pk": "network_id",
    },
    {
    "model": "RouteNetwork",
    "fields": [
        {
            "name": "network_id",
            "type": "fk",
            "references": Network,
            "required": "true",
        },
        {
            "name": "route_id",
            "type": "fk",
            "references": Route,
            "required": "true",
        },
        ],
        "pk": "route_id",
    },
    {
    "model": "Shape",
    "fields": [
        {
            "name": "shape_id",
            "type": "pk",
            "required": "true",
        }, 
        {
            "name": "shape_pt_lat",
            "type": "float",
            "required": "true",
        },
        {
            "name": "shape_pt_lon",
            "type": "float",
            "required": "true",
        },
        {
            "name": "shape_pt_sequence",
            "type": "int",
            "required": "true",
        },
        {
            "name": "shape_dist_traveled",
            "type": "float",
            "required": "true",
        },
        ],
        "pk": ["shape_id", "shape_pt_sequence"],
    },
    {
    "model": "Frequency",
    "fields": [
        {
            "name": "trip_id",
            "type": "fk",
            "references": Trip,
            "required": "true",
        }, 
        {
            "name": "start_time",
            "type": "time",
            "required": "true",
        },
        {
            "name": "end_time",
            "type": "time",
            "required": "true",
        },
        {
            "name": "headway_secs",
            "type": "unsigned",
            "required": "true",
        },
        {
            "name": "exact_times",
            "type": "enum",
            "allowed_values": [0,1,],
            "required": "false",
        },
        ],
        "pk": ["trip_id", "start_time"],
    },
    {
    "model": "Transfers",
    "fields": [
        {
            "name": "from_stop_id",
            "type": "fk",
            "references": Stop,
            "required": "false",
        }, 
        {
            "name": "to_stop_id",
            "type": "fk",
            "references": Stop,
            "required": "false",
        },
        {
            "name": "transfer_type",
            "type": "enum",
            "allowed_values": [0,1,2,3,4,5,],
            "required": "true",
        },
		{
			"name": "from_route_id",
			"type": "fk",
            "references": Route,
			"required": "false",
		},
		{
			"name": "to_route_id",
			"type": "fk",
            "references": Route,
			"required": "false",
		},
		{
			"name": "from_trip_id",
			"type": "fk",
            "references": Trip,
			"required": "false",
		},
		{
			"name": "to_trip_id",
			"type": "fk",
            "references": Trip,
			"required": "false",
		},
        {
            "name": "min_transfer_time",
            "type": "unsigned",
            "required": "false",
        },
        ],
        "pk": ["from_trip_id", "to_trip_id", "from_stop_id", "to_stop_id", "from_route_id", "to_route_id"],
    },
    {
    "model": "Pathway",
    "fields": [
		{
			"name": "pathway_id",
			"type": "pk",
			"required": "true",
		},
		{
			"name": "from_stop_id",
			"type": "fk",
            "references": Stop,
			"required": "true",
		},
		{
			"name": "to_stop_id",
			"type": "fk",
            "references": Stop,
			"required": "true",
		},
		{
			"name": "pathway_mode",
			"type": "enum",
            "allowed_values": [1,2,3,4,5,6,7,],
			"required": "true",
		},
		{
			"name": "is_bidirectional",
			"type": "enum",
            "allowed_values": [0,1,],
			"required": "true",
		},
		{
			"name": "length",
			"type": "float",
			"required": "false",
		},
		{
			"name": "traversal_time",
			"type": "unsigned",
			"required": "false",
		},
		{
			"name": "stair_count",
			"type": "int",
			"required": "false",
		},
		{
			"name": "max_slope",
			"type": "float",
			"required": "false",
		},
		{
			"name": "min_width",
			"type": "float",
			"required": "false",
		},
		{
			"name": "signposted_as",
			"type": "str",
			"required": "false",
		},
		{
			"name": "reversed_signposted_as",
			"type": "str",
			"required": "false",
		},
        ],
        "pk": "pathway_id",
    },
    {
    "model": "Level",
    "fields": [
        {
            "name": "level_id",
            "type": "pk",
            "required": "true",
        },
        {
            "name": "level_index",
            "type": "float",
            "required": "true",
        },
        {
            "name": "level_name",
            "type": "str",
            "required": "false",
        },
        ],
        "pk": "level_id",
    },
    {
    "model": "LocationGroup",
    "fields": [
        {
            "name": "location_group_id",
            "type": "pk",
            "required": "true",
        },
        {
            "name": "location_group_name",
            "type": "str",
            "required": "false",
        },
        ],
        "pk": "location_group_id",
    },
    {
    "model": "LocationGroupStop",
    "fields": [
        {
            "name": "location_group_id",
            "type": "fk",
            "references": LocationGroup,
            "required": "true",
        },
        {
            "name": "stop_id",
            "type": "fk",
            "references": Stop,
            "required": "true",
        },
        ],
        "pk": None,
    },
    {
    "model": "BookingRule",
    "fields": [
        {
            "name": "booking_rule_id",
            "type": "pk",
            "required": "true",
        },
        {
            "name": "booking_type",
            "type": "enum",
            "allowed_values": [0,1,2,],
            "required": "false",
        },
        {
            "name": "prior_notice_duration_min",
            "type": "unsigned",
            "required": "if",
            "required_if": [["booking_type", 1]],
            "forbidden_if_not": [["booking_type", 1]]
        },
        {
            "name": "prior_notice_duration_max",
            "type": "unsigned",
            "required": "if",
            "required_if_not": [["booking_type", 1]],
            "forbidden_if": [["booking_type", 1]]
        },
        {
            "name": "prior_notice_last_day",
            "type": "unsigned",
            "required": "if",
            "required_if": [["booking_type", 2]],
            "forbidden_if_not": [["booking_type", 2]]
        },
        {
            "name": "prior_notice_last_time",
            "type": "time",
            "required": "if",
            "required_if_not": [["prior_notice_last_day", None]],
            "forbidden_if": [["prior_notice_last_day", None]],
        },
        {
            "name": "prior_notice_start_day",
            "type": "unsigned",
            "required": "false",
            "forbidden_if": [["booking_type", 0],],
            "forbidden_if_not": [["booking_type", 1], ["prior_notice_duration_max", None]],
        },
        {
            "name": "prior_notice_start_time",
            "type": "time",
            "required": "if",
            "required_if_not": [["prior_notice_start_day", None]],
            "forbidden_if": [["prior_notice_last_day", None]],
        },
        {
            "name": "prior_notice_service_id",
            "type": "str",
            "required": "false",
            "forbidden_if_not": [["booking_type", 2]],
        },
        {
            "name": "message",
            "type": "str",
            "required": "false",
        },
        {
            "name": "pickup_message",
            "type": "str",
            "required": "false",
        },
        {
            "name": "drop_off_message",
            "type": "str",
            "required": "false",
        },
        {
            "name": "phone_number",
            "type": "telephone",
            "required": "false",
        },
        {
            "name": "info_url",
            "type": "url",
            "required": "false",
        },
        {
            "name": "booking_url",
            "type": "url",
            "required": "false",
        },
        ],
        "pk": "booking_rule_id",
    },
    {
    "model": "Translation",
    "fields": [
        {
            "name": "table_name",
            "type": "enum",
            "allowed_values": ["agency", "stops", "routes", "trips", "stop_times", "pathways", "levels", "feed_info", "attributions"],
            "required": "true",
        },
        {
            "name": "field_name",
            "type": "str",
            "required": "true",
        },
        {
            "name": "language",
            "type": "lancode",
            "required": "true",
        },
        {
            "name": "translation",
            "type": "str",
            "required": "true",
        },
        {
            "name": "record_id",
            "type": "fk",
            "references": "table_name",
            "required": "if",
            "required_if": [["field_value", None]],
            "forbidden_if": [["table_name", "feed_info"]],
            "forbidden_if_not": [["field_value", None]],
        },
        {
            "name": "record_sub_id",
            "type": "str",
            "required": "if",
            "required_if": [["table_name", "stop_times"], ["record_id", not None]],
            "forbidden_if": [["table_name", "feed_info"]],
            "forbidden_if_not": [["field_value", None]],
        },
        {
            "name": "field_value",
            "type": "str",
            "required": "if",
            "required_if": [["record_id", None]],
            "forbidden_if": [["table_name", "feed_info"]],
            "forbidden_if_not": [["record_id", None]],
        },
        ],
        "pk": ["table_name", "field_name", "language", "record_id", "record_sub_id", "field_value"],
    },
    {
    "model": "FeedInfo",
    "fields": [
        {
            "name": "feed_publisher_name",
            "type": "str",
            "required": "true",
        }, 
        {
            "name": "feed_publisher_url",
            "type": "url",
            "required": "true",
        },
        {
            "name": "feed_lang",
            "type": "langcode",
            "required": "true",
        },
        {
            "name": "default_lang",
            "type": "langcode",
            "required": "false",
        },
        {
            "name": "feed_start_date",
            "type": "date",
            "required": "false",
        },
        {
            "name": "feed_end_date",
            "type": "date",
            "required": "false",
        },
        {
            "name": "feed_version",
            "type": "str",
            "required": "false",
        },
        {
            "name": "feed_contact_url",
            "type": "url",
            "required": "false",
        },
        {
            "name": "feed_contact_email",
            "type": "email",
            "required": "false",
        },
        ],
        "pk": None,
    },
    {
    "model": "Attribution",
    "fields": [
    	{
			"name": "attribution_id",
			"type": "pk",
			"required": "false",
    	},
		{
			"name": "agency_id",
			"type": "fk",
            "references": Agency,
			"required": "false",
    	},
		{
			"name": "route_id",
			"type": "fk",
            "references": Route,
			"required": "false",
    	},
		{
			"name": "trip_id",
			"type": "fk",
            "references": Trip,
			"required": "false",
    	},
		{
			"name": "organization_name",
			"type": "str",
			"required": "true",
    	},
		{
			"name": "is_producer",
			"type": "enum",
            "allowed_values": [0,1,],
			"required": "false",
    	},
		{
			"name": "is_operator",
			"type": "enum",
            "allowed_values": [0,1,],
			"required": "false",
    	},
		{
			"name": "is_authority",
			"type": "str",
			"required": "false",
    	},
		{
			"name": "attribution_url",
			"type": "enum",
            "allowed_values": [0,1,],
			"required": "false",
    	},
		{
			"name": "attribution_email",
			"type": "url",
			"required": "false",
    	},
		{
			"name": "attribution_phone",
			"type": "telephone",
			"required": "false",
        },
        ],
        "pk": "attribution_id",
    },

]

