// Copyright 2025, ANSYS Inc. Unauthorized use, distribution or duplication is prohibited.
syntax = "proto3";
package ansys.api.discovery.v0.connections.contact;

import "ansys/api/dbu/v0/dbumodels.proto";
import "ansys/api/discovery/v0/discoverymodels.proto";

option csharp_namespace = "Ansys.Api.Discovery.V0.Connections";

service Contact
{
  //Contact condition methods
  rpc CreateContact(ContactCreationRequest) returns (ContactCreationResponse);

  rpc ChangeContactSide1Location(ChangeLocationRequest) returns(ChangeResponse);
  rpc ChangeContactSide2Location(ChangeLocationRequest) returns(ChangeResponse);

  rpc ChangeContactType(ChangeContactTypeRequest) returns (ChangeResponse);
  rpc ChangeContactPairs(ChangeContactPairRequest) returns (ChangeResponse);
  rpc Split(ChangeEmptyRequest) returns (ChangeResponse);

  rpc ChangeFrictionCoefficient(ChangeDoubleRequest) returns (ChangeResponse);
  rpc ChangeStiffnessFactor(ChangeDoubleRequest) returns (ChangeResponse);
  rpc ChangeDetectionRadiusFactor(ChangeDoubleRequest) returns (ChangeResponse);
  rpc ChangeOffset(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeShearStrength(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeTensileStrength(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeAreStrengthLimitsSet(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeAdjustGapOrOverlap(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeMakeJustTouching(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeIdealize(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeSpecifyThermalConductance(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeSpecifyThermalConductanceFromThicknessAndMaterial(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeSpecifyElectricConductance(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeSpecifyElectricConductanceFromThicknessAndMaterial(ChangeBooleanRequest) returns (ChangeResponse);
  rpc ChangeThermalContactConductance(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeThermalConductanceThickness(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeElectricContactConductance(ChangeQuantityRequest) returns (ChangeResponse);
  rpc ChangeElectricConductanceThickness(ChangeQuantityRequest) returns (ChangeResponse);
}

message ContactCreationRequest{
  DoubleSidedScopedCreationData creation_data = 1;
  ContactProperties contact_properties = 2;
}

message ContactCreationResponse{
  CreationResponse condition_response = 1;
  ContactDefinition condition_data = 2;
}

message ChangeContactTypeRequest{
  ansys.api.dbu.v0.PhysicsEntityIdentifier object_id = 1;
  ContactType contact_type = 2;
}

message ChangeContactPairRequest{
  ansys.api.dbu.v0.PhysicsEntityIdentifier object_id = 1;
  ContactPairs contact_pairs = 2;
}

// Contact condition definitions

enum ContactType {
  BONDED_CONTACT = 0;
  SLIDING_CONTACT = 1;
  PREVENTED_CONTACT = 2;
}

message ContactPairs {
  repeated ContactPair contact_pair = 1;
}

message ContactPair {
  repeated string item1 = 1;
  repeated string item2 = 2;
}

message ContactProperties {
  ContactType contact_type = 1;
  ContactPairs contact_pairs = 2;
  double friction_coefficient = 3;
  double stiffness_factor = 4;
  double detection_radius_factor = 5;
  Quantity offset = 6;
  Quantity shear_strenght = 7;
  Quantity tensile_strength = 8;
  bool are_strength_limits_set = 9;
  bool adjust_gap_or_overlap = 10;
  bool make_just_touching = 11;
  bool idealize = 12;
  bool specify_thermal_conductance = 13;
  bool specify_thermal_conductance_from_thickness_and_material = 14;
  bool specify_electric_conductance = 15;
  bool specify_electric_conductance_from_thickness_and_material = 16;
  Quantity thermal_contact_conductance = 17;
  Quantity thermal_conductance_thickness = 18;
  Quantity electrical_contact_conductance = 19;
  Quantity electrical_conductance_thickness = 20;
}

message ContactDefinition {
  ansys.api.dbu.v0.PhysicsEntityIdentifier id = 1;
  ansys.api.dbu.v0.PhysicsEntityIdentifier parent_id = 2;
  string label = 3;
  repeated string side1_locations = 4;
  repeated string side2_locations = 5;
  bool suppressed = 6;
  ContactProperties contact = 7;
}