package code.api.BahrainOBF.v1_0_0

import scala.language.implicitConversions
import code.api.berlin.group.v1_3.JvalueCaseClass
import code.api.util.APIUtil._
import code.api.util.ApiTag
import code.api.util.ApiTag._
import code.api.util.ErrorMessages._
import com.github.dwickern.macros.NameOf.nameOf
import com.openbankproject.commons.ExecutionContext.Implicits.global
import net.liftweb.common.Full
import net.liftweb.http.rest.RestHelper
import net.liftweb.json
import net.liftweb.json._

import scala.collection.immutable.Nil
import scala.collection.mutable.ArrayBuffer

object APIMethods_DomesticFutureDatedPaymentConsentsApi extends RestHelper {
    val apiVersion =  ApiCollector.apiVersion
    val resourceDocs = ArrayBuffer[ResourceDoc]()
    val apiRelations = ArrayBuffer[ApiRelation]()
    protected implicit def JvalueToSuper(what: JValue): JvalueCaseClass = JvalueCaseClass(what)

    val endpoints = 
      domesticFutureDatedPaymentCancellationConsentsConsentIdGet ::
      domesticFutureDatedPaymentCancellationConsentsPost ::
      domesticFutureDatedPaymentConsentsConsentIdGet ::
      domesticFutureDatedPaymentConsentsPost ::
      Nil

            
     resourceDocs += ResourceDoc(
       domesticFutureDatedPaymentCancellationConsentsConsentIdGet, 
       apiVersion, 
       nameOf(domesticFutureDatedPaymentCancellationConsentsConsentIdGet),
       "GET", 
       "/domestic-future-dated-payment-cancellation-consents/CONSENT_ID", 
       "Get Domestic Future Dated Payment Cancellation Consents by ConsentId",
       s"""${mockedDataText(true)}
            
            """,
       json.parse(""""""),
       json.parse("""{
  "Data" : {
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "DomesticFutureDatedPaymentId" : "DomesticFutureDatedPaymentId",
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ConsentId" : "ConsentId",
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""),
       List(AuthenticatedUserIsRequired, UnknownError),
       ApiTag("Domestic Future Dated Payment Consents") :: apiTagMockedData :: Nil
     )

     lazy val domesticFutureDatedPaymentCancellationConsentsConsentIdGet : OBPEndpoint = {
       case "domestic-future-dated-payment-cancellation-consents" :: consentId :: Nil JsonGet _ => {
         cc =>
           for {
             (Full(u), callContext) <- authenticatedAccess(cc, AuthenticatedUserIsRequired)
             } yield {
            (json.parse("""{
  "Data" : {
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "DomesticFutureDatedPaymentId" : "DomesticFutureDatedPaymentId",
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ConsentId" : "ConsentId",
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""), callContext)
           }
         }
       }
            
     resourceDocs += ResourceDoc(
       domesticFutureDatedPaymentCancellationConsentsPost, 
       apiVersion, 
       nameOf(domesticFutureDatedPaymentCancellationConsentsPost),
       "POST", 
       "/domestic-future-dated-payment-cancellation-consents", 
       "Create Domestic Future Dated Payment Cancellation Consents",
       s"""${mockedDataText(true)}
            
            """,
       json.parse("""{
  "Data" : {
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "DomesticFutureDatedPaymentId" : "DomesticFutureDatedPaymentId",
    "Permission" : "Create",
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""),
       json.parse("""{
  "Data" : {
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "DomesticFutureDatedPaymentId" : "DomesticFutureDatedPaymentId",
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ConsentId" : "ConsentId",
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""),
       List(AuthenticatedUserIsRequired, UnknownError),
       ApiTag("Domestic Future Dated Payment Consents") :: apiTagMockedData :: Nil
     )

     lazy val domesticFutureDatedPaymentCancellationConsentsPost : OBPEndpoint = {
       case "domestic-future-dated-payment-cancellation-consents" :: Nil JsonPost _ => {
         cc =>
           for {
             (Full(u), callContext) <- authenticatedAccess(cc, AuthenticatedUserIsRequired)
             } yield {
            (json.parse("""{
  "Data" : {
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "DomesticFutureDatedPaymentId" : "DomesticFutureDatedPaymentId",
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ConsentId" : "ConsentId",
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""), callContext)
           }
         }
       }
            
     resourceDocs += ResourceDoc(
       domesticFutureDatedPaymentConsentsConsentIdGet, 
       apiVersion, 
       nameOf(domesticFutureDatedPaymentConsentsConsentIdGet),
       "GET", 
       "/domestic-future-dated-payment-consents/CONSENT_ID", 
       "Get Domestic Future Dated Payment Consents by ConsentId",
       s"""${mockedDataText(true)}
            
            """,
       json.parse(""""""),
       json.parse("""{
  "Meta" : {
    "FirstAvailableDateTime" : { },
    "TotalPages" : 0
  },
  "Links" : {
    "Last" : "http://example.com/aeiou",
    "Prev" : "http://example.com/aeiou",
    "Next" : "http://example.com/aeiou",
    "First" : "http://example.com/aeiou",
    "Self" : "http://example.com/aeiou"
  },
  "Risk" : {
    "DeliveryAddress" : {
      "CountrySubDivision" : [ "CountrySubDivision", "CountrySubDivision" ],
      "AddressLine" : [ "AddressLine", "AddressLine" ],
      "Country" : "Country"
    },
    "PaymentContextCode" : "BillPayment",
    "MerchantCategoryCode" : "MerchantCategoryCode",
    "MerchantCustomerIdentification" : "MerchantCustomerIdentification"
  },
  "Data" : {
    "Status" : "Authorised",
    "ConsentId" : "ConsentId",
    "SCASupportData" : {
      "RequestedSCAExemptionType" : "BillPayment",
      "AppliedAuthenticationApproach" : "CA",
      "ReferencePaymentOrderId" : "ReferencePaymentOrderId"
    },
    "StatusUpdateDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Debtor" : {
      "Name" : "Name"
    },
    "CreationDateTime" : "2000-01-23T04:56:07.000+00:00",
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "CutOffDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Authorisation" : {
      "CompletionDateTime" : "2000-01-23T04:56:07.000+00:00",
      "AuthorisationType" : "Single"
    },
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ReadRefundAccount" : "No",
    "Initiation" : {
      "SupplementaryData" : { },
      "LocalInstrument" : { },
      "DebtorAccount" : {
        "Name" : "Name"
      },
      "RemittanceInformation" : {
        "RemittanceDescription" : "RemittanceDescription",
        "Reference" : "Reference"
      },
      "EndToEndIdentification" : "EndToEndIdentification",
      "InstructionIdentification" : "InstructionIdentification",
      "CreditorAccount" : {
        "Identification" : { },
        "SchemeName" : { },
        "Name" : "Name"
      },
      "CreditorPostalAddress" : {
        "CountrySubDivision" : { },
        "StreetName" : { },
        "Department" : { },
        "AddressLine" : [ "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine" ],
        "BuildingNumber" : { },
        "TownName" : { },
        "Country" : { },
        "SubDepartment" : { },
        "AddressType" : { },
        "PostCode" : { }
      },
      "InstructedAmount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "RequestedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00"
    },
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""),
       List(AuthenticatedUserIsRequired, UnknownError),
       ApiTag("Domestic Future Dated Payment Consents") :: apiTagMockedData :: Nil
     )

     lazy val domesticFutureDatedPaymentConsentsConsentIdGet : OBPEndpoint = {
       case "domestic-future-dated-payment-consents" :: consentId :: Nil JsonGet _ => {
         cc =>
           for {
             (Full(u), callContext) <- authenticatedAccess(cc, AuthenticatedUserIsRequired)
             } yield {
            (json.parse("""{
  "Meta" : {
    "FirstAvailableDateTime" : { },
    "TotalPages" : 0
  },
  "Links" : {
    "Last" : "http://example.com/aeiou",
    "Prev" : "http://example.com/aeiou",
    "Next" : "http://example.com/aeiou",
    "First" : "http://example.com/aeiou",
    "Self" : "http://example.com/aeiou"
  },
  "Risk" : {
    "DeliveryAddress" : {
      "CountrySubDivision" : [ "CountrySubDivision", "CountrySubDivision" ],
      "AddressLine" : [ "AddressLine", "AddressLine" ],
      "Country" : "Country"
    },
    "PaymentContextCode" : "BillPayment",
    "MerchantCategoryCode" : "MerchantCategoryCode",
    "MerchantCustomerIdentification" : "MerchantCustomerIdentification"
  },
  "Data" : {
    "Status" : "Authorised",
    "ConsentId" : "ConsentId",
    "SCASupportData" : {
      "RequestedSCAExemptionType" : "BillPayment",
      "AppliedAuthenticationApproach" : "CA",
      "ReferencePaymentOrderId" : "ReferencePaymentOrderId"
    },
    "StatusUpdateDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Debtor" : {
      "Name" : "Name"
    },
    "CreationDateTime" : "2000-01-23T04:56:07.000+00:00",
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "CutOffDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Authorisation" : {
      "CompletionDateTime" : "2000-01-23T04:56:07.000+00:00",
      "AuthorisationType" : "Single"
    },
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ReadRefundAccount" : "No",
    "Initiation" : {
      "SupplementaryData" : { },
      "LocalInstrument" : { },
      "DebtorAccount" : {
        "Name" : "Name"
      },
      "RemittanceInformation" : {
        "RemittanceDescription" : "RemittanceDescription",
        "Reference" : "Reference"
      },
      "EndToEndIdentification" : "EndToEndIdentification",
      "InstructionIdentification" : "InstructionIdentification",
      "CreditorAccount" : {
        "Identification" : { },
        "SchemeName" : { },
        "Name" : "Name"
      },
      "CreditorPostalAddress" : {
        "CountrySubDivision" : { },
        "StreetName" : { },
        "Department" : { },
        "AddressLine" : [ "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine" ],
        "BuildingNumber" : { },
        "TownName" : { },
        "Country" : { },
        "SubDepartment" : { },
        "AddressType" : { },
        "PostCode" : { }
      },
      "InstructedAmount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "RequestedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00"
    },
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""), callContext)
           }
         }
       }
            
     resourceDocs += ResourceDoc(
       domesticFutureDatedPaymentConsentsPost, 
       apiVersion, 
       nameOf(domesticFutureDatedPaymentConsentsPost),
       "POST", 
       "/domestic-future-dated-payment-consents", 
       "Create Domestic Future Dated Payment Consents",
       s"""${mockedDataText(true)}
            
            """,
       json.parse("""{
  "Risk" : {
    "DeliveryAddress" : {
      "CountrySubDivision" : [ "CountrySubDivision", "CountrySubDivision" ],
      "AddressLine" : [ "AddressLine", "AddressLine" ],
      "Country" : "Country"
    },
    "PaymentContextCode" : "BillPayment",
    "MerchantCategoryCode" : "MerchantCategoryCode",
    "MerchantCustomerIdentification" : "MerchantCustomerIdentification"
  },
  "Data" : {
    "SCASupportData" : {
      "RequestedSCAExemptionType" : "BillPayment",
      "AppliedAuthenticationApproach" : "CA",
      "ReferencePaymentOrderId" : "ReferencePaymentOrderId"
    },
    "Authorisation" : {
      "CompletionDateTime" : "2000-01-23T04:56:07.000+00:00",
      "AuthorisationType" : "Single"
    },
    "Permission" : "Create",
    "ReadRefundAccount" : "No",
    "Initiation" : {
      "SupplementaryData" : { },
      "LocalInstrument" : { },
      "DebtorAccount" : {
        "Name" : "Name"
      },
      "RemittanceInformation" : {
        "RemittanceDescription" : "RemittanceDescription",
        "Reference" : "Reference"
      },
      "EndToEndIdentification" : "EndToEndIdentification",
      "InstructionIdentification" : "InstructionIdentification",
      "CreditorAccount" : {
        "Identification" : { },
        "SchemeName" : { },
        "Name" : "Name"
      },
      "CreditorPostalAddress" : {
        "CountrySubDivision" : { },
        "StreetName" : { },
        "Department" : { },
        "AddressLine" : [ "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine" ],
        "BuildingNumber" : { },
        "TownName" : { },
        "Country" : { },
        "SubDepartment" : { },
        "AddressType" : { },
        "PostCode" : { }
      },
      "InstructedAmount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "RequestedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00"
    }
  }
}"""),
       json.parse("""{
  "Meta" : {
    "FirstAvailableDateTime" : { },
    "TotalPages" : 0
  },
  "Links" : {
    "Last" : "http://example.com/aeiou",
    "Prev" : "http://example.com/aeiou",
    "Next" : "http://example.com/aeiou",
    "First" : "http://example.com/aeiou",
    "Self" : "http://example.com/aeiou"
  },
  "Risk" : {
    "DeliveryAddress" : {
      "CountrySubDivision" : [ "CountrySubDivision", "CountrySubDivision" ],
      "AddressLine" : [ "AddressLine", "AddressLine" ],
      "Country" : "Country"
    },
    "PaymentContextCode" : "BillPayment",
    "MerchantCategoryCode" : "MerchantCategoryCode",
    "MerchantCustomerIdentification" : "MerchantCustomerIdentification"
  },
  "Data" : {
    "Status" : "Authorised",
    "ConsentId" : "ConsentId",
    "SCASupportData" : {
      "RequestedSCAExemptionType" : "BillPayment",
      "AppliedAuthenticationApproach" : "CA",
      "ReferencePaymentOrderId" : "ReferencePaymentOrderId"
    },
    "StatusUpdateDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Debtor" : {
      "Name" : "Name"
    },
    "CreationDateTime" : "2000-01-23T04:56:07.000+00:00",
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "CutOffDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Authorisation" : {
      "CompletionDateTime" : "2000-01-23T04:56:07.000+00:00",
      "AuthorisationType" : "Single"
    },
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ReadRefundAccount" : "No",
    "Initiation" : {
      "SupplementaryData" : { },
      "LocalInstrument" : { },
      "DebtorAccount" : {
        "Name" : "Name"
      },
      "RemittanceInformation" : {
        "RemittanceDescription" : "RemittanceDescription",
        "Reference" : "Reference"
      },
      "EndToEndIdentification" : "EndToEndIdentification",
      "InstructionIdentification" : "InstructionIdentification",
      "CreditorAccount" : {
        "Identification" : { },
        "SchemeName" : { },
        "Name" : "Name"
      },
      "CreditorPostalAddress" : {
        "CountrySubDivision" : { },
        "StreetName" : { },
        "Department" : { },
        "AddressLine" : [ "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine" ],
        "BuildingNumber" : { },
        "TownName" : { },
        "Country" : { },
        "SubDepartment" : { },
        "AddressType" : { },
        "PostCode" : { }
      },
      "InstructedAmount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "RequestedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00"
    },
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""),
       List(AuthenticatedUserIsRequired, UnknownError),
       ApiTag("Domestic Future Dated Payment Consents") :: apiTagMockedData :: Nil
     )

     lazy val domesticFutureDatedPaymentConsentsPost : OBPEndpoint = {
       case "domestic-future-dated-payment-consents" :: Nil JsonPost _ => {
         cc =>
           for {
             (Full(u), callContext) <- authenticatedAccess(cc, AuthenticatedUserIsRequired)
             } yield {
            (json.parse("""{
  "Meta" : {
    "FirstAvailableDateTime" : { },
    "TotalPages" : 0
  },
  "Links" : {
    "Last" : "http://example.com/aeiou",
    "Prev" : "http://example.com/aeiou",
    "Next" : "http://example.com/aeiou",
    "First" : "http://example.com/aeiou",
    "Self" : "http://example.com/aeiou"
  },
  "Risk" : {
    "DeliveryAddress" : {
      "CountrySubDivision" : [ "CountrySubDivision", "CountrySubDivision" ],
      "AddressLine" : [ "AddressLine", "AddressLine" ],
      "Country" : "Country"
    },
    "PaymentContextCode" : "BillPayment",
    "MerchantCategoryCode" : "MerchantCategoryCode",
    "MerchantCustomerIdentification" : "MerchantCustomerIdentification"
  },
  "Data" : {
    "Status" : "Authorised",
    "ConsentId" : "ConsentId",
    "SCASupportData" : {
      "RequestedSCAExemptionType" : "BillPayment",
      "AppliedAuthenticationApproach" : "CA",
      "ReferencePaymentOrderId" : "ReferencePaymentOrderId"
    },
    "StatusUpdateDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Debtor" : {
      "Name" : "Name"
    },
    "CreationDateTime" : "2000-01-23T04:56:07.000+00:00",
    "ExpectedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00",
    "CutOffDateTime" : "2000-01-23T04:56:07.000+00:00",
    "Authorisation" : {
      "CompletionDateTime" : "2000-01-23T04:56:07.000+00:00",
      "AuthorisationType" : "Single"
    },
    "Permission" : "Create",
    "Charges" : [ {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    }, {
      "Type" : { },
      "Amount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "ChargeBearer" : { }
    } ],
    "ReadRefundAccount" : "No",
    "Initiation" : {
      "SupplementaryData" : { },
      "LocalInstrument" : { },
      "DebtorAccount" : {
        "Name" : "Name"
      },
      "RemittanceInformation" : {
        "RemittanceDescription" : "RemittanceDescription",
        "Reference" : "Reference"
      },
      "EndToEndIdentification" : "EndToEndIdentification",
      "InstructionIdentification" : "InstructionIdentification",
      "CreditorAccount" : {
        "Identification" : { },
        "SchemeName" : { },
        "Name" : "Name"
      },
      "CreditorPostalAddress" : {
        "CountrySubDivision" : { },
        "StreetName" : { },
        "Department" : { },
        "AddressLine" : [ "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine", "AddressLine" ],
        "BuildingNumber" : { },
        "TownName" : { },
        "Country" : { },
        "SubDepartment" : { },
        "AddressType" : { },
        "PostCode" : { }
      },
      "InstructedAmount" : {
        "Amount" : { },
        "Currency" : { }
      },
      "RequestedExecutionDateTime" : "2000-01-23T04:56:07.000+00:00"
    },
    "ExpectedSettlementDateTime" : "2000-01-23T04:56:07.000+00:00"
  }
}"""), callContext)
           }
         }
       }

}



