/**
 * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
 *
 * WSO2 LLC. licenses this file to you 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.
 */

@App:name("DisputeResolutionImplementationApp")

@source(type='wso2event',  @map(type='wso2event'))
define stream DisputeResolutionStream(STATUS_CODE int, HTTP_METHOD string, TIMESTAMP long,
                               REQUEST_BODY string, RESPONSE_BODY string, ELECTED_RESOURCE string,
                               HEADERS string);

@primaryKey('ID')
@store(type='rdbms', datasource='OB_REPORTING_DB', field.length="REQUEST_BODY:4096, RESPONSE_BODY:4096, HEADERS:2048")
define table DISPUTE_RESOLUTION_DATA(ID string, STATUS_CODE int, HTTP_METHOD string, TIMESTAMP long,
                               REQUEST_BODY string, RESPONSE_BODY string, ELECTED_RESOURCE string,
                               HEADERS string);


from DisputeResolutionStream
select UUID() as ID, STATUS_CODE, HTTP_METHOD, TIMESTAMP, REQUEST_BODY, RESPONSE_BODY, ELECTED_RESOURCE, HEADERS
insert into DISPUTE_RESOLUTION_DATA;

