// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed 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.
{namespace registry.soy.registrar.domainepp autoescape="strict"}
/* General Availability. Sunrush down below. */
/**
* Domain create request.
* @param item
* @param clTrid
*/
{template .create}
{$item['domain:name']}
{if isNonnull($item['domain:period'])}
{$item['domain:period']}
{/if}
{if isNonnull($item['domain:ns'])}
{foreach $hostObj in $item['domain:ns']['domain:hostObj']}
{$hostObj.value}
{/foreach}
{/if}
{if isNonnull($item['domain:registrant'])}
{$item['domain:registrant']}
{/if}
{if isNonnull($item['domain:contact'])}
{foreach $contact in $item['domain:contact']}
{$contact.value}
{/foreach}
{/if}
{$item['domain:authInfo']['domain:pw']}
{$clTrid}
{/template}
/**
* Domain info request.
* @param id
* @param clTrid
*/
{template .info}
{$id}
{$clTrid}
{/template}
/**
* Domain update request.
* @param item
* @param clTrid
* @param? addHosts list of hostObj to add.
* @param? remHosts list of hostObj to remove.
* @param? addContacts list of contact to add.
* @param? remContacts list of contact to remove.
*/
{template .update}
{$item['domain:name']}
{if isNonnull($addHosts) or isNonnull($addContacts)}
{call .addRem}
{param isAdd: true /}
{param hosts: $addHosts /}
{param contacts: $addContacts /}
{/call}
{/if}
{if isNonnull($remHosts) or isNonnull($remContacts)}
{call .addRem}
{param isAdd: false /}
{param hosts: $remHosts /}
{param contacts: $remContacts /}
{/call}
{/if}
{$item['domain:registrant']}
{$item['domain:authInfo']['domain:pw']}
{$clTrid}
{/template}
/**
* @param isAdd
* @param? hosts
* @param? contacts
*/
{template .addRem}
{let $tagName: $isAdd ? 'domain:add' : 'domain:rem' /}
<{$tagName}>
{if isNonnull($hosts)}
{foreach $host in $hosts}
{$host.value}
{/foreach}
{/if}
{if isNonnull($contacts)}
{foreach $contact in $contacts}
{$contact.value}
{/foreach}
{/if}
{$tagName}>
{/template}
/* Sunrush. */
/**
* Domain create request for sunrush.
* @param item
* @param clTrid
*/
{template .createSunrush}
{$item['domain:name']}
{$item['domain:period']}
{if isNonnull($item['domain:ns']['domain:hostObj'][0])}
{$item['domain:ns']['domain:hostObj'][0]}
{if isNonnull($item['domain:ns']['domain:hostObj'][1])}
{$item['domain:ns']['domain:hostObj'][1]}
{/if}
{/if}
{$item['domain:registrant']}
{$item['domain:contact'][0]}
{$item['domain:contact'][1]}
{$item['domain:pw']}
sunrise
{if isNonnull($item['smd:encodedSignedMark'])}
{$item['smd:encodedSignedMark']}
{/if}
{$clTrid}
{/template}
/**
* Domain info request during sunrush.
* @param name
* @param applicationID
* @param clTrid
*/
{template .infoSunrush}
{$name}
sunrise
{$applicationID}
{$clTrid}
{/template}
/**
* Domain update request.
* @param item
* @param clTrid
*/
{template .updateSunrush}
{$item['domain:name']}
{$item['domain:registrant']}
{$item['domain:authInfo']['domain:pw']}
sunrise
{$item['launch:applicationID']}
{$clTrid}
{/template}