// Copyright 2025 Google LLC
//
// 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.

syntax = "proto3";

package google.cloud.networksecurity.v1alpha1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.NetworkSecurity.V1Alpha1";
option go_package = "cloud.google.com/go/networksecurity/apiv1alpha1/networksecuritypb;networksecuritypb";
option java_multiple_files = true;
option java_outer_classname = "GatewaySecurityPolicyProto";
option java_package = "com.google.cloud.networksecurity.v1alpha1";
option php_namespace = "Google\\Cloud\\NetworkSecurity\\V1alpha1";
option ruby_package = "Google::Cloud::NetworkSecurity::V1alpha1";

// The GatewaySecurityPolicy resource contains a collection of
// GatewaySecurityPolicyRules and associated metadata.
message GatewaySecurityPolicy {
  option (google.api.resource) = {
    type: "networksecurity.googleapis.com/GatewaySecurityPolicy"
    pattern: "projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}"
  };

  // Required. Name of the resource. Name is of the form
  // projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}
  // gateway_security_policy should match the
  // pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Output only. The timestamp when the resource was created.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The timestamp when the resource was updated.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Free-text description of the resource.
  string description = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Name of a TLS Inspection Policy resource that defines how TLS
  // inspection will be performed for any rule(s) which enables it.
  string tls_inspection_policy = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "networksecurity.googleapis.com/TlsInspectionPolicy"
    }
  ];
}

// Request used by the CreateGatewaySecurityPolicy method.
message CreateGatewaySecurityPolicyRequest {
  // Required. The parent resource of the GatewaySecurityPolicy. Must be in the
  // format `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "networksecurity.googleapis.com/GatewaySecurityPolicy"
    }
  ];

  // Required. Short name of the GatewaySecurityPolicy resource to be created.
  // This value should be 1-63 characters long, containing only
  // letters, numbers, hyphens, and underscores, and should not start
  // with a number. E.g. "gateway_security_policy1".
  string gateway_security_policy_id = 2
      [(google.api.field_behavior) = REQUIRED];

  // Required. GatewaySecurityPolicy resource to be created.
  GatewaySecurityPolicy gateway_security_policy = 3
      [(google.api.field_behavior) = REQUIRED];
}

// Request used with the ListGatewaySecurityPolicies method.
message ListGatewaySecurityPoliciesRequest {
  // Required. The project and location from which the GatewaySecurityPolicies
  // should be listed, specified in the format
  // `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Maximum number of GatewaySecurityPolicies to return per call.
  int32 page_size = 2;

  // The value returned by the last
  // 'ListGatewaySecurityPoliciesResponse' Indicates that this is a
  // continuation of a prior 'ListGatewaySecurityPolicies' call, and
  // that the system should return the next page of data.
  string page_token = 3;
}

// Response returned by the ListGatewaySecurityPolicies method.
message ListGatewaySecurityPoliciesResponse {
  // List of GatewaySecurityPolicies resources.
  repeated GatewaySecurityPolicy gateway_security_policies = 1;

  // If there might be more results than those appearing in this response, then
  // 'next_page_token' is included. To get the next set of results, call this
  // method again using the value of 'next_page_token' as 'page_token'.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// Request used by the GetGatewaySecurityPolicy method.
message GetGatewaySecurityPolicyRequest {
  // Required. A name of the GatewaySecurityPolicy to get. Must be in the format
  // `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "networksecurity.googleapis.com/GatewaySecurityPolicy"
    }
  ];
}

// Request used by the DeleteGatewaySecurityPolicy method.
message DeleteGatewaySecurityPolicyRequest {
  // Required. A name of the GatewaySecurityPolicy to delete. Must be in the
  // format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "networksecurity.googleapis.com/GatewaySecurityPolicy"
    }
  ];
}

// Request used by the UpdateGatewaySecurityPolicy method.
message UpdateGatewaySecurityPolicyRequest {
  // Optional. Field mask is used to specify the fields to be overwritten in the
  // GatewaySecurityPolicy resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Required. Updated GatewaySecurityPolicy resource.
  GatewaySecurityPolicy gateway_security_policy = 2
      [(google.api.field_behavior) = REQUIRED];
}
