--[[
Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]

local M = require('acf2.model')

local Host = M.new()
Host.address = M.net.IPAddress{addr='ipaddr'}
Host.canonical = M.String{ui_name='Canonical name'}
Host.alias = M.Set{type=M.String, ui_name='Aliases', ui_member='Alias'}

local Resolv = M.new()
Resolv.servers = M.List{type=M.net.IPAddress, addr='nameserver'}
Resolv['search-domains'] = M.List{type=M.String, addr='search/domain'}

local Net = M.new()
Net['host-name'] = M.String{addr='/augeas/etc/hostname/hostname'}
Net.hosts = M.List{type=Host, addr='/augeas/etc/hosts'}
Net.resolver = M.Model{
   model=Resolv, addr='/augeas/etc/resolv.conf', ui_name='DNS resolver'
}

M.register('net', Net, {ui_name='Network'})
M.permission.defaults('/net')
