class Terminalwire::Client::Entitlement::Policy

def authority_path

def authority_path
  root_path.join("authorities/#{authority}")
end

def initialize(authority:)

def initialize(authority:)
  @authority = authority
  @paths = Paths.new
  # Permit the domain directory. This is necessary for basic operation of the client.
  @paths.permit storage_path
  @paths.permit storage_pattern
  @schemes = Schemes.new
  # Permit http & https by default.
  @schemes.permit "http"
  @schemes.permit "https"
end

def root_path

def root_path
  Pathname.new(ROOT_PATH)
end

def serialize

def serialize
  {
    authority: @authority,
    schemes: @schemes.serialize,
    paths: @paths.serialize,
    storage_path: storage_path.to_s,
  }
end

def storage_path

def storage_path
  authority_path.join("storage")
end

def storage_pattern

def storage_pattern
  storage_path.join("**/*")
end