import Foundation
import ServiceStack
public class ProcessQuickLookup : QuickLookup
{
    public var entityContext:String
    required public init(){ super.init() }
    private enum CodingKeys : String, CodingKey {
        case entityContext
    }
    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        entityContext = try container.decodeIfPresent(String.self, forKey: .entityContext)
    }
    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if entityContext != nil { try container.encode(entityContext, forKey: .entityContext) }
    }
}
public class QuickLookup : Codable
{
    public var documentID:String?
    public var documentFieldID:String
    public var registrationProfileFieldID:String
    public var lookupValue:String
    public var dependableFields:[RegistrationProfileFieldValue] = []
    public var applyOptionalFilters:Bool
    required public init(){}
}
public class RegistrationProfileFieldValue : Codable
{
    public var documentFieldID:String
    public var value:String
    public var shadowValue:String
    public var isModifiedByUser:Bool
    required public init(){}
}
public class QuickLookupResponse : IBaseQuickLookupResponse, Codable
{
    public var numberOfAllRecords:Int
    public var values:[SerializableKeyValuePair<String,String>] = []
    public var quickAddOptions:[QuickAddOption] = []
    required public init(){}
}
public class QuickAddOption : Codable
{
    public var name:String
    public var entityType:String
    required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/ProcessQuickLookup HTTP/1.1 
Host: doapigw.baasbv.nl 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
	EntityContext: String,
	DocumentID: 00000000-0000-0000-0000-000000000000,
	DocumentFieldID: String,
	RegistrationProfileFieldID: String,
	LookupValue: String,
	DependableFields: 
	[
		{
			Value: String,
			ShadowValue: String,
			IsModifiedByUser: False
		}
	],
	ApplyOptionalFilters: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
	NumberOfAllRecords: 0,
	Values: 
	[
		{
			
		}
	],
	QuickAddOptions: 
	[
		{
			Name: String,
			EntityType: String
		}
	]
}