// Copyright 2017 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}
/* General Availability. */
/**
* Domain create request.
*/
{template .create stricthtml="false"}
{@param item: ?}
{@param clTrid: ?}
{$item['domain:name']}
{if isNonnull($item['domain:period'])}
{$item['domain:period']}
{/if}
{if isNonnull($item['domain:ns'])}
{for $hostObj in $item['domain:ns']['domain:hostObj']}
{$hostObj.value}
{/for}
{/if}
{if isNonnull($item['domain:registrant'])}
{$item['domain:registrant']}
{/if}
{if isNonnull($item['domain:contact'])}
{for $contact in $item['domain:contact']}
{$contact.value}
{/for}
{/if}
{$item['domain:authInfo']['domain:pw']}
{$clTrid}
{/template}
/**
* Domain info request.
*/
{template .info stricthtml="false"}
{@param id: ?}
{@param clTrid: ?}
{$id}
{$clTrid}
{/template}
/**
* Domain update request.
*/
{template .update stricthtml="false"}
{@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. */
{$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}
{template .addRem}
{@param isAdd: ?}
{@param? hosts: ?}
{@param? contacts: ?}
{let $tagName: $isAdd ? 'domain:add' : 'domain:rem' /}
<{$tagName}>
{if isNonnull($hosts)}
{for $host in $hosts}
{$host.value}
{/for}
{/if}
{if isNonnull($contacts)}
{for $contact in $contacts}
{$contact.value}
{/for}
{/if}
{$tagName}>
{/template}